]> source.dussan.org Git - archiva.git/commitdiff
align maven api to use maven 3 version
authorOlivier Lamy <olamy@apache.org>
Fri, 10 Jun 2011 15:37:00 +0000 (15:37 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 10 Jun 2011 15:37:00 +0000 (15:37 +0000)
temporary comment failing dependency tree

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134349 13f79535-47bb-0310-9956-ffa450edef68

archiva-cli/pom.xml
archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/plugins/maven2-repository/pom.xml
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
pom.xml

index 207b43da60637b111f6ca3b62a691e5bc8073390..733299940f544d9c728940cd9ef854c4cbe88599 100644 (file)
@@ -68,7 +68,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
+      <artifactId>maven-compat</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
index c5ae11579048890ebe069853123c2e1a440a9071..4c5373692a856b5b569f405158e87d014a082757 100644 (file)
@@ -39,7 +39,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
+      <artifactId>maven-compat</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
index cf774fe0d984dba5958683046b35a8ea34f3db05..8a155bc7cd90d42c24ce4ed308826e116d0303db 100644 (file)
@@ -50,9 +50,9 @@ public class PlexusSisuBridge
 
     private Logger log = LoggerFactory.getLogger( getClass() );
 
-    private boolean containerAutoWiring = false;
+    private boolean containerAutoWiring = true;
 
-    private String containerClassPathScanning = PlexusConstants.SCANNING_OFF;
+    private String containerClassPathScanning = PlexusConstants.SCANNING_ON;
 
     private String containerComponentVisibility = PlexusConstants.REALM_VISIBILITY;
 
@@ -91,7 +91,7 @@ public class PlexusSisuBridge
 
         conf.setRealm( classRealm );
 
-        conf.setClassWorld( classWorld );
+        //conf.setClassWorld( classWorld );
 
         try
         {
index b795ab84b7d9f01787a4202f5718db191cd53875..8c42cfc91f0846aea18c2e91f7ac23fc1bc83fd9 100644 (file)
       <artifactId>maven-model-builder</artifactId>
       <version>${maven3x.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-compat</artifactId>
+      <version>${maven3x.version}</version>
+    </dependency>
 
     <dependency>
       <groupId>org.sonatype.sisu</groupId>
index 9b560c6b3381267972837ff9b4e6b7b0582e2289..94eacf6f5141bbd708d4f06aede143b0e5db4f46 100644 (file)
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-model-builder</artifactId>
     </dependency>
-    <!-- TODO: remove when dependency-tree declares it explicitly, it is currently through the excluded maven-project -->
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-compat</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-dependency-tree</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
-  <dependencyManagement>
-    <dependencies>
-      <!-- TODO: this is to override the top level dependency management - we need to rationalise these -->
-      <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-model</artifactId>
-        <version>3.0.3</version>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
   <build>
     <plugins>
       <plugin>
index 758442715d56e38e86044670b58b8b4e541ac97e..44c4d71227f0a8e4c4d7ab5f20f06bfc1e16834b 100644 (file)
@@ -39,6 +39,7 @@ import org.apache.maven.artifact.metadata.ResolutionGroup;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactCollector;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ResolutionListener;
 import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
@@ -51,11 +52,13 @@ import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Exclusion;
 import org.apache.maven.model.Model;
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
 import org.apache.maven.model.building.DefaultModelBuildingRequest;
 import org.apache.maven.model.building.ModelBuilder;
 import org.apache.maven.model.building.ModelBuildingException;
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.resolution.UnresolvableModelException;
+import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
 import org.apache.maven.shared.dependency.tree.DependencyNode;
 import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
 import org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener;
@@ -141,9 +144,12 @@ public class DefaultDependencyTreeBuilder
     public void initialize()
         throws PlexusSisuBridgeException
     {
-        factory = plexusSisuBridge.lookup( ArtifactFactory.class );
-        collector = plexusSisuBridge.lookup( ArtifactCollector.class );
-        builder = plexusSisuBridge.lookup( ModelBuilder.class );
+        //factory = plexusSisuBridge.lookup( ArtifactFactory.class , "default" );
+        //collector = plexusSisuBridge.lookup( ArtifactCollector.class , "default" );
+
+
+        DefaultModelBuilderFactory defaultModelBuilderFactory = new DefaultModelBuilderFactory();
+        builder = defaultModelBuilderFactory.newInstance();
     }
 
     public void buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId, String version,
@@ -179,8 +185,18 @@ public class DefaultDependencyTreeBuilder
 
                 // Note that we don't permit going to external repositories. We don't need to pass in a local and remote
                 // since our metadata source has control over them
-                collector.collect( dependencyArtifacts, projectArtifact, managedVersions, null, null, metadataSource,
-                                   null, Collections.singletonList( listener ) );
+                //collector.collect( dependencyArtifacts, projectArtifact, managedVersions, null, null, metadataSource,
+                //                   null, Collections.singletonList( listener ) );
+
+                collector.collect( dependencyArtifacts, projectArtifact, null, Collections.<ArtifactRepository>emptyList(),
+                                   metadataSource, null,  Collections.singletonList( (ResolutionListener) listener ) );
+
+                /*
+                Set<Artifact> artifacts, Artifact originatingArtifact,
+                                      ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
+                                      ArtifactMetadataSource source, ArtifactFilter filter,
+                                      List< ResolutionListener > listeners
+                */
             }
             finally
             {
@@ -440,11 +456,11 @@ public class DefaultDependencyTreeBuilder
                 // if the project is null, we encountered an invalid model (read: m1 POM)
                 // we'll just return an empty resolution group.
                 // or used the inherited scope (should that be passed to the buildFromRepository method above?)
-                result = new ResolutionGroup( pomArtifact, Collections.emptySet(), Collections.emptyList() );
+                result = new ResolutionGroup( pomArtifact, Collections.<Artifact>emptySet(), Collections.<ArtifactRepository>emptyList() );
             }
             else
             {
-                Set artifacts = Collections.emptySet();
+                Set<Artifact> artifacts = Collections.emptySet();
                 if ( !artifact.getArtifactHandler().isIncludesDependencies() )
                 {
                     try
@@ -457,7 +473,7 @@ public class DefaultDependencyTreeBuilder
                     }
                 }
 
-                result = new ResolutionGroup( pomArtifact, artifacts, Collections.emptyList() );
+                result = new ResolutionGroup( pomArtifact, artifacts, Collections.<ArtifactRepository>emptyList() );
             }
 
             return result;
@@ -488,6 +504,29 @@ public class DefaultDependencyTreeBuilder
 
             return new ArrayList<ArtifactVersion>( versions );
         }
+
+        public ResolutionGroup retrieve( MetadataResolutionRequest metadataResolutionRequest )
+            throws ArtifactMetadataRetrievalException
+        {
+            //TODO
+            return null;
+        }
+
+        public List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest metadataResolutionRequest )
+            throws ArtifactMetadataRetrievalException
+        {
+            //TODO
+            return null;
+        }
+
+        public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
+                                                                                        ArtifactRepository artifactRepository,
+                                                                                        ArtifactRepository artifactRepository1 )
+            throws ArtifactMetadataRetrievalException
+        {
+            // TODO
+            return null;
+        }
     }
 
     public ArtifactFactory getFactory()
index 963d4733c04e2005d8e3955434254c85842e7954..73f843c650965eb20225ec1e050cb349b473baf4 100644 (file)
@@ -19,12 +19,11 @@ package org.apache.archiva.dependency.tree.maven2;
  * under the License.
  */
 
-import java.util.List;
-
-import org.apache.maven.artifact.factory.DefaultArtifactFactory;
 import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
 import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
 
+import java.util.List;
+
 /**
  * Builds a tree of dependencies for a given Maven project. Customized wrapper for maven-dependency-tree to use
  * maven-model-builder instead of maven-project.
@@ -41,7 +40,7 @@ public interface DependencyTreeBuilder
      * @param nodeVisitor   visitor to apply to all nodes discovered
      * @throws DependencyTreeBuilderException if the dependency tree cannot be resolved
      */
-    public void buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId, String version,
-                                     DependencyNodeVisitor nodeVisitor )
+    void buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId, String version,
+                              DependencyNodeVisitor nodeVisitor )
         throws DependencyTreeBuilderException;
 }
index 943fcf7c00f7ea44206820da2f8146d7770f8fff..5eaa390f8c204683d801abce9b0e387ae5d6b6df 100644 (file)
@@ -21,8 +21,6 @@ package org.apache.archiva.metadata.repository.storage.maven2;
 
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.model.ProjectMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
@@ -43,6 +41,7 @@ import org.apache.maven.model.MailingList;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Organization;
 import org.apache.maven.model.Scm;
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
 import org.apache.maven.model.building.DefaultModelBuildingRequest;
 import org.apache.maven.model.building.ModelBuilder;
 import org.apache.maven.model.building.ModelBuildingException;
@@ -102,14 +101,12 @@ public class Maven2RepositoryStorage
 
     private static final String METADATA_FILENAME = "maven-metadata.xml";
 
-    @Inject
-    private PlexusSisuBridge plexusSisuBridge;
 
     @PostConstruct
     public void initialize()
-        throws PlexusSisuBridgeException
     {
-        builder = plexusSisuBridge.lookup( ModelBuilder.class, "default" );
+        DefaultModelBuilderFactory defaultModelBuilderFactory = new DefaultModelBuilderFactory();
+        builder = defaultModelBuilderFactory.newInstance();
     }
 
     public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId )
diff --git a/pom.xml b/pom.xml
index 6bd275e36f71156fb0c930f39bfeeff5dcbd0993..7e98aeb3c1d53d2f2a3846ad88bb2b91bdb2db91 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,6 @@
 
   <properties>
     <struts.version>2.1.8.1</struts.version>
-    <maven.version>2.0.8</maven.version>
     <maven3x.version>3.0.3</maven3x.version>
     <wagon.version>1.0-beta-5</wagon.version>
     <redback.version>1.3-SNAPSHOT</redback.version>
         <artifactId>maven-model-builder</artifactId>
         <version>${maven3x.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-compat</artifactId>
+        <version>${maven3x.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-core</artifactId>
+        <version>${maven3x.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-digest</artifactId>
           </exclusion>
         </exclusions>
       </dependency>
-      <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-artifact-manager</artifactId>
-        <version>${maven.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-container-default</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
       <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-artifact</artifactId>
-        <version>${maven.version}</version>
+        <version>${maven3x.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-repository-metadata</artifactId>
-        <version>${maven.version}</version>
+        <version>${maven3x.version}</version>
       </dependency>
       <dependency>
         <groupId>net.sf.ehcache</groupId>