]> source.dussan.org Git - archiva.git/commitdiff
some progress on new indexer
authorolivier lamy <olamy@apache.org>
Fri, 23 Jun 2017 23:33:50 +0000 (09:33 +1000)
committerolivier lamy <olamy@apache.org>
Fri, 23 Jun 2017 23:33:50 +0000 (09:33 +1000)
Signed-off-by: olivier lamy <olamy@apache.org>
archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java
archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml
archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java
pom.xml

index 448851ee768d994c6f337813a28929d3841505cd..dc94ad5fec973d41901009395b8892ff7d3fe06d 100644 (file)
@@ -20,18 +20,11 @@ package org.apache.archiva.common.plexusbridge;
  */
 
 import org.apache.maven.index.context.IndexCreator;
-import org.apache.maven.index.creator.JarFileContentsIndexCreator;
-import org.apache.maven.index.creator.MavenArchetypeArtifactInfoIndexCreator;
-import org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator;
-import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator;
-import org.apache.maven.index.creator.OsgiArtifactIndexCreator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -44,32 +37,14 @@ public class MavenIndexerUtils
 
     private Logger log = LoggerFactory.getLogger( getClass() );
 
+    @Inject
     private List<? extends IndexCreator> allIndexCreators;
 
-    @Inject
-    public MavenIndexerUtils( PlexusSisuBridge plexusSisuBridge )
-        throws PlexusSisuBridgeException
+    public MavenIndexerUtils()
     {
-        allIndexCreators = new ArrayList( plexusSisuBridge.lookupList( IndexCreator.class ) );
-
-        if ( allIndexCreators == null || allIndexCreators.isEmpty() )
-        {
-            // olamy when the TCL is not a URLClassLoader lookupList fail !
-            // when using tomcat maven plugin so adding a simple hack
-            log.warn( "using lookupList from sisu plexus failed so build indexCreator manually" );
-
-            allIndexCreators =
-                Arrays.asList( plexusSisuBridge.lookup( IndexCreator.class, OsgiArtifactIndexCreator.ID ),
-                               plexusSisuBridge.lookup( IndexCreator.class, MavenArchetypeArtifactInfoIndexCreator.ID ),
-                               plexusSisuBridge.lookup( IndexCreator.class, MinimalArtifactInfoIndexCreator.ID ),
-                               plexusSisuBridge.lookup( IndexCreator.class, JarFileContentsIndexCreator.ID ),
-                               plexusSisuBridge.lookup( IndexCreator.class, MavenPluginArtifactInfoIndexCreator.ID ) );
-
-        }
-
         if ( allIndexCreators == null || allIndexCreators.isEmpty() )
         {
-            throw new PlexusSisuBridgeException( "no way to initiliaze IndexCreator" );
+            throw new RuntimeException( "cannot initiliaze IndexCreators" );
         }
 
         log.debug( "allIndexCreators {}", allIndexCreators );
index 41188dcd82aee3ee18a05042e796c263fc1649e2..cd6acffd90bd6921ee068e7722c28a33d7edb847 100644 (file)
@@ -28,5 +28,5 @@
        default-lazy-init="true">
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.common.plexusbridge"/>
+  <context:component-scan base-package="org.apache.archiva.common.plexusbridge,org.apache.maven.index"/>
 </beans>
\ No newline at end of file
index 4b164e7c6ba4edcdb99f9f99e222379f28881211..44a2d7beb5b569ada74581f5c322fb6305cf2eb7 100644 (file)
     <dependency>
       <groupId>org.apache.maven.indexer</groupId>
       <artifactId>indexer-core</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.sonatype.sisu</groupId>
-          <artifactId>sisu-guava</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.sonatype.sisu</groupId>
-          <artifactId>sisu-guice</artifactId>
-        </exclusion>
-      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.archetype</groupId>
index 8f390530bbfdfe9e380164fec70c4a5aac16eae2..bf8d88b1873faf2e379873c98e2086660c8c36c3 100644 (file)
@@ -23,9 +23,6 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.RemoteRepository;
 import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
@@ -60,29 +57,15 @@ public class DefaultRemoteRepositoryAdmin
 {
 
     @Inject
-    private PlexusSisuBridge plexusSisuBridge;
-
-    @Inject
-    private MavenIndexerUtils mavenIndexerUtils;
-
-    // fields
     private List<? extends IndexCreator> indexCreators;
 
+    @Inject
     private NexusIndexer indexer;
 
     @PostConstruct
     private void initialize()
         throws RepositoryAdminException
     {
-        try
-        {
-            indexCreators = mavenIndexerUtils.getAllIndexCreators();
-            indexer = plexusSisuBridge.lookup( NexusIndexer.class );
-        }
-        catch ( PlexusSisuBridgeException e )
-        {
-            throw new RepositoryAdminException( e.getMessage(), e );
-        }
         for ( RemoteRepository remoteRepository : getRemoteRepositories() )
         {
             createIndexContext( remoteRepository );
@@ -323,7 +306,7 @@ public class DefaultRemoteRepositoryAdmin
             }
             return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory,
                                                remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ),
-                                               mavenIndexerUtils.getAllIndexCreators() );
+                                               indexCreators );
         }
         catch ( MalformedURLException e )
         {
index 04e14fb3b4ea9236907fa729ea6260bde9a74bad..aa4743ccc76a7b48d5a2d0903d659eab8fc5606e 100644 (file)
@@ -29,7 +29,7 @@
 
   <context:annotation-config />
   <context:component-scan
-    base-package="org.apache.archiva.admin.repository,org.apache.maven.index"/>
+    base-package="org.apache.archiva.admin.repository"/>
 
   <alias name="redbackRuntimeConfigurationAdmin#default" alias="userConfiguration#archiva"/>
 
index debf5c907b0d92261fc4c73962cd28f8b5388a1f..a232391f0bdb0364583b19dd93a17e0f8ef2d1c1 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.metadata.repository.jcr;
  * under the License.
  */
 
+import com.google.common.base.Objects;
 import org.apache.archiva.metadata.model.MetadataFacetFactory;
 import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
 import org.apache.commons.io.FileUtils;
diff --git a/pom.xml b/pom.xml
index bbaf7f8395a5b3fd21decd041d20bb236fe5d7e3..8abfddf47c08e7ee1d9a56f883eb961ab74d9b69 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
     <javaxMailVersion>1.4</javaxMailVersion>
     <!--jettyVersion>9.4.5.v20170502</jettyVersion-->
     <jettyVersion>9.4.7-SNAPSHOT</jettyVersion>
-    <guava.version>22.0</guava.version>
+    <guava.version>15.0</guava.version>
     <openjpaVersion>2.4.1</openjpaVersion>
 
     <!-- restore when we will be able to use a derby in memory database -->
             <groupId>com.google.code.atinject</groupId>
             <artifactId>atinject</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>org.sonatype.sisu</groupId>
+            <artifactId>sisu-guava</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.sonatype.sisu</groupId>
+            <artifactId>sisu-guice</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.maven.archetype</groupId>
         <artifactId>archetype-common</artifactId>
         <version>3.0.1</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>*</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.sonatype.sisu</groupId>
+            <artifactId>*</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <dependency>