Author: cstamas Date: Fri Dec 10 18:35:16 2010 New Revision: 1044472 URL: http://svn.apache.org/viewvc?rev=1044472&view=rev Log: Bumping trunk version of Indexer to 4.0.0 and
o aligning it with Maven3.x o introducing use of Aether Version o smaller fixes with creeped in deps (commons-io vs plexus-util) in UT Modified: maven/indexer/trunk/indexer-artifact/pom.xml maven/indexer/trunk/indexer-core/pom.xml maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DownloadRemoteIndexerManagerTest.java maven/indexer/trunk/pom.xml Modified: maven/indexer/trunk/indexer-artifact/pom.xml URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-artifact/pom.xml?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/indexer-artifact/pom.xml (original) +++ maven/indexer/trunk/indexer-artifact/pom.xml Fri Dec 10 18:35:16 2010 @@ -24,7 +24,7 @@ under the License. <parent> <groupId>org.apache.maven.indexer</groupId> <artifactId>maven-indexer</artifactId> - <version>3.2.0-SNAPSHOT</version> + <version>4.0.0-SNAPSHOT</version> </parent> <artifactId>indexer-artifact</artifactId> Modified: maven/indexer/trunk/indexer-core/pom.xml URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/pom.xml?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/pom.xml (original) +++ maven/indexer/trunk/indexer-core/pom.xml Fri Dec 10 18:35:16 2010 @@ -6,13 +6,14 @@ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.maven.indexer</groupId> <artifactId>maven-indexer</artifactId> - <version>3.2.0-SNAPSHOT</version> + <version>4.0.0-SNAPSHOT</version> </parent> <artifactId>indexer-core</artifactId> @@ -20,9 +21,10 @@ <name>Maven :: Indexer Core</name> <properties> - <maven.version>2.2.1</maven.version> + <maven.version>3.0.1</maven.version> + <aether.version>1.8</aether.version> <archetype.version>2.0-alpha-4</archetype.version> - <wagon.version>1.0-beta-6</wagon.version> + <wagon.version>1.0-beta-7</wagon.version> </properties> <!-- IMPORTANT! * WHEN YOU CHANGE DEPS MAKE SURE TO UPDATE SHADE CONFIG! * DON'T FORGET OTHERWISE YOU ARE RENDERING CLI @@ -41,17 +43,21 @@ <artifactId>sisu-inject-plexus</artifactId> </dependency> - <!-- Maven --> + <!-- Aether --> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> - <version>${maven.version}</version> + <groupId>org.sonatype.aether</groupId> + <artifactId>aether-util</artifactId> + <version>${aether.version}</version> </dependency> + + <!-- Maven --> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-model</artifactId> <version>${maven.version}</version> </dependency> + + <!-- Wagon, as optional for those want to use ResourceFetcher backed by Wagons --> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> @@ -59,7 +65,7 @@ <optional>true</optional> </dependency> - <!-- Using archetypeDataSource from it only --> + <!-- Using org.apache.maven.archetype.source.ArchetypeDataSource from it only --> <dependency> <groupId>org.apache.maven.archetype</groupId> <artifactId>archetype-common</artifactId> @@ -86,6 +92,38 @@ <groupId>velocity</groupId> <artifactId>velocity</artifactId> </exclusion> + <exclusion> + <artifactId>jchardet</artifactId> + <groupId>net.sourceforge.jchardet</groupId> + </exclusion> + <exclusion> + <artifactId>dom4j</artifactId> + <groupId>dom4j</groupId> + </exclusion> + <exclusion> + <artifactId>jdom</artifactId> + <groupId>jdom</groupId> + </exclusion> + <exclusion> + <artifactId>maven-model</artifactId> + <groupId>org.apache.maven</groupId> + </exclusion> + <exclusion> + <artifactId>plexus-velocity</artifactId> + <groupId>org.codehaus.plexus</groupId> + </exclusion> + <exclusion> + <artifactId>velocity</artifactId> + <groupId>org.apache.velocity</groupId> + </exclusion> + <exclusion> + <artifactId>commons-io</artifactId> + <groupId>commons-io</groupId> + </exclusion> + <exclusion> + <artifactId>commons-collections</artifactId> + <groupId>commons-collections</groupId> + </exclusion> </exclusions> </dependency> @@ -183,9 +221,9 @@ <include>aspectj:aspectjrt</include> <include>commons-cli:commons-cli</include> <include>org.apache.lucene:lucene-core</include> - <include>org.apache.maven:maven-artifact</include> + <include>org.sonatype.aether:aether-api</include> + <include>org.sonatype.aether:aether-util</include> <include>org.apache.maven:maven-model</include> - <include>org.apache.maven:maven-plugin-api</include> <include>org.codehaus.plexus:plexus-cli</include> <include>org.codehaus.plexus:plexus-component-annotations</include> <include>org.codehaus.plexus:plexus-classworlds</include> Modified: maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java (original) +++ maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java Fri Dec 10 18:35:16 2010 @@ -26,8 +26,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.index.artifact.Gav; import org.apache.maven.index.artifact.IllegalArtifactCoordinateException; import org.apache.maven.index.artifact.VersionUtils; @@ -35,6 +33,9 @@ import org.apache.maven.index.creator.Ja import org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator; import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator; import org.codehaus.plexus.util.StringUtils; +import org.sonatype.aether.util.version.GenericVersionScheme; +import org.sonatype.aether.version.InvalidVersionSpecificationException; +import org.sonatype.aether.version.Version; /** * ArtifactInfo holds the values known about an repository artifact. This is a simple Value Object kind of stuff. @@ -153,8 +154,7 @@ public class ArtifactInfo public String version; - @Deprecated - private transient ArtifactVersion artifactVersion; + private transient Version artifactVersion; private transient float luceneScore; @@ -222,13 +222,31 @@ public class ArtifactInfo this.classifier = classifier; } - @Deprecated - public ArtifactVersion getArtifactVersion() + public Version getArtifactVersion() { if ( artifactVersion == null ) { - artifactVersion = new DefaultArtifactVersion( version ); + GenericVersionScheme scheme = new GenericVersionScheme(); + + try + { + artifactVersion = scheme.parseVersion( version ); + } + catch ( InvalidVersionSpecificationException e ) + { + // will not happen, only with version ranges but we should not have those + // we handle POM versions here, not dependency versions + try + { + artifactVersion = scheme.parseVersion( "0.0" ); + } + catch ( InvalidVersionSpecificationException e1 ) + { + // noo + } + } } + return artifactVersion; } @@ -464,7 +482,6 @@ public class ArtifactInfo static class VersionComparator implements Comparator<ArtifactInfo> { - @SuppressWarnings( "unchecked" ) public int compare( ArtifactInfo f1, ArtifactInfo f2 ) { int n = f1.groupId.compareTo( f2.groupId ); Modified: maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java (original) +++ maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java Fri Dec 10 18:35:16 2010 @@ -30,7 +30,9 @@ import org.apache.maven.archetype.source import org.apache.maven.index.ArtifactInfo; import org.apache.maven.index.FlatSearchRequest; import org.apache.maven.index.FlatSearchResponse; +import org.apache.maven.index.MAVEN; import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.SearchType; import org.apache.maven.index.context.IndexingContext; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; @@ -56,14 +58,10 @@ public class NexusArchetypeDataSource { Map<String, String> repositories = getRepositoryMap(); - Query pq = indexer.constructQuery( ArtifactInfo.PACKAGING, "^maven-archetype$" ); + Query pq = indexer.constructQuery( MAVEN.PACKAGING, "maven-archetype", SearchType.EXACT ); FlatSearchRequest searchRequest = new FlatSearchRequest( pq ); - // cstamas: old code was this - // FlatSearchRequest searchRequest = new FlatSearchRequest( // - // new TermQuery( new Term( ArtifactInfo.PACKAGING, "maven-archetype" ) ) ); - FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest ); for ( ArtifactInfo info : searchResponse.getResults() ) @@ -107,11 +105,4 @@ public class NexusArchetypeDataSource { // TODO maybe update index } - - // cstamas removed. is this needed? Settings is in maven-core and it brings a lot of deps to manage - // public void updateCatalog( Properties properties, Archetype archetype, Settings settings ) - // { - // TODO maybe update index - // } - } Modified: maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DownloadRemoteIndexerManagerTest.java URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DownloadRemoteIndexerManagerTest.java?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DownloadRemoteIndexerManagerTest.java (original) +++ maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DownloadRemoteIndexerManagerTest.java Fri Dec 10 18:35:16 2010 @@ -34,10 +34,10 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.io.FileUtils; import org.apache.lucene.document.Document; import org.apache.maven.index.context.DocumentFilter; import org.apache.maven.index.context.IndexingContext; +import org.codehaus.plexus.util.FileUtils; import org.mortbay.jetty.Handler; import org.mortbay.jetty.Response; import org.mortbay.jetty.Server; @@ -169,7 +169,7 @@ public class DownloadRemoteIndexerManage FileUtils.forceDelete( destination ); lastMod = indexFile.lastModified(); } - FileUtils.copyDirectory( source, destination, false ); + FileUtils.copyDirectory( source, destination ); long lastMod2 = indexFile.lastModified(); assertTrue( lastMod < lastMod2 ); Modified: maven/indexer/trunk/pom.xml URL: http://svn.apache.org/viewvc/maven/indexer/trunk/pom.xml?rev=1044472&r1=1044471&r2=1044472&view=diff ============================================================================== --- maven/indexer/trunk/pom.xml (original) +++ maven/indexer/trunk/pom.xml Fri Dec 10 18:35:16 2010 @@ -28,7 +28,7 @@ under the License. <groupId>org.apache.maven.indexer</groupId> <artifactId>maven-indexer</artifactId> - <version>3.2.0-SNAPSHOT</version> + <version>4.0.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Maven :: Indexer</name>