switch to archetype-catalog dep
As we really just provide helper class to implement
org.apache.maven.archetype.source.ArchetypeDataSource
diff --git a/indexer-core/pom.xml b/indexer-core/pom.xml
index adde18b..9f8597b 100644
--- a/indexer-core/pom.xml
+++ b/indexer-core/pom.xml
@@ -132,7 +132,7 @@
<!-- Using org.apache.maven.archetype.source.ArchetypeDataSource from it only -->
<dependency>
<groupId>org.apache.maven.archetype</groupId>
- <artifactId>archetype-common</artifactId>
+ <artifactId>archetype-catalog</artifactId>
<optional>true</optional>
</dependency>
diff --git a/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java b/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
index f3f7bd5..d71f446 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
@@ -19,17 +19,16 @@
* under the License.
*/
-import javax.inject.Inject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import javax.inject.Inject;
+
import org.apache.lucene.search.Query;
import org.apache.maven.archetype.catalog.Archetype;
import org.apache.maven.archetype.catalog.ArchetypeCatalog;
-import org.apache.maven.archetype.source.ArchetypeDataSource;
-import org.apache.maven.archetype.source.ArchetypeDataSourceException;
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.FlatSearchRequest;
import org.apache.maven.index.FlatSearchResponse;
@@ -40,8 +39,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Support class to implement {@code org.apache.maven.archetype.source.ArchetypeDataSource} interface. Extend this class
+ * to suit your needs.
+ */
public abstract class AbstractArchetypeDataSource
- implements ArchetypeDataSource
{
private final Logger logger = LoggerFactory.getLogger( getClass() );
@@ -61,7 +63,6 @@
}
public ArchetypeCatalog getArchetypeCatalog( final Properties properties )
- throws ArchetypeDataSourceException
{
final ArchetypeCatalog catalog = new ArchetypeCatalog();
try
diff --git a/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java b/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java
deleted file mode 100644
index de1285e..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/archetype/NexusArchetypeDataSource.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.maven.index.archetype;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to 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.
- */
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.index.Indexer;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
-
-/**
- * Nexus Archetype Data Source.
- *
- * @author Eugene Kuleshov
- * @deprecated Extend {@link AbstractArchetypeDataSource} instead, and make it suit your case.
- */
-@Deprecated
-@Named("nexus")
-@Singleton
-public class NexusArchetypeDataSource
- extends AbstractArchetypeDataSource
-{
-
- private final NexusIndexer nexusIndexer;
-
-
- @Inject
- public NexusArchetypeDataSource( Indexer indexer,
- NexusIndexer nexusIndexer )
- {
- super( indexer );
- this.nexusIndexer = nexusIndexer;
- }
-
- @Override
- protected List<IndexingContext> getIndexingContexts()
- {
- return new ArrayList<>( nexusIndexer.getIndexingContexts().values() );
- }
-}
diff --git a/indexer-core/src/test/java/org/apache/maven/index/archetype/NexusArchetypeDataSourceTest.java b/indexer-core/src/test/java/org/apache/maven/index/archetype/NexusArchetypeDataSourceTest.java
deleted file mode 100644
index 4164f3a..0000000
--- a/indexer-core/src/test/java/org/apache/maven/index/archetype/NexusArchetypeDataSourceTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.apache.maven.index.archetype;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to 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.
- */
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.maven.archetype.catalog.ArchetypeCatalog;
-import org.apache.maven.archetype.source.ArchetypeDataSource;
-import org.apache.maven.index.AbstractIndexCreatorHelper;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
-import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
-
-public class NexusArchetypeDataSourceTest
- extends AbstractIndexCreatorHelper
-{
- private IndexingContext context;
-
- private NexusIndexer nexusIndexer;
-
- // private IndexUpdater indexUpdater;
-
- private NexusArchetypeDataSource nexusArchetypeDataSource;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- prepare( true );
- }
-
- private void prepare( boolean inRam )
- throws Exception, IOException, UnsupportedExistingLuceneIndexException
- {
- nexusIndexer = lookup( NexusIndexer.class );
-
- // indexUpdater = lookup( IndexUpdater.class );
-
- Directory indexDir = null;
-
- if ( inRam )
- {
- indexDir = new RAMDirectory();
- }
- else
- {
- File indexDirFile = super.getDirectory( "index/test" );
-
- super.deleteDirectory( indexDirFile );
-
- indexDir = FSDirectory.open( indexDirFile.toPath() );
- }
-
- File repo = new File( getBasedir(), "src/test/repo" );
-
- context =
- nexusIndexer.addIndexingContext( "test", "public", repo, indexDir,
- "http://repository.sonatype.org/content/groups/public/", null, DEFAULT_CREATORS );
- nexusIndexer.scan( context );
-
- // to update, uncomment this
- // IndexUpdateRequest updateRequest = new IndexUpdateRequest( context );
- // indexUpdater.fetchAndUpdateIndex( updateRequest );
-
- nexusArchetypeDataSource = (NexusArchetypeDataSource) lookup( ArchetypeDataSource.class, "nexus" );
- }
-
- public void testArchetype()
- throws Exception
- {
- ArchetypeCatalog catalog = nexusArchetypeDataSource.getArchetypeCatalog( null );
-
- assertEquals( "Not correct numbers of archetypes in catalog!", 4, catalog.getArchetypes().size() );
- }
-
-}
diff --git a/pom.xml b/pom.xml
index 0118b7b..1ee9394 100644
--- a/pom.xml
+++ b/pom.xml
@@ -257,69 +257,11 @@
<version>${wagon.version}</version>
</dependency>
- <!-- Using org.apache.maven.archetype.source.ArchetypeDataSource from it only -->
+ <!-- For org.apache.maven.archetype.source.ArchetypeDataSource helper -->
<dependency>
<groupId>org.apache.maven.archetype</groupId>
- <artifactId>archetype-common</artifactId>
+ <artifactId>archetype-catalog</artifactId>
<version>${archetype.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven.archetype</groupId>
- <artifactId>archetype-registry</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-velocity</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.sourceforge.jchardet</groupId>
- <artifactId>jchardet</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.archetype</groupId>
- <artifactId>archetype-descriptor</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-invoker</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<!-- ZipFacade -->