summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-10 15:37:00 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-10 15:37:00 +0000
commit45b308aab041fc4d0e4c198f32a1d4f57d366ed7 (patch)
tree97f097d83cde642b08e03111b737e539e5447c57
parentd9ba2b6814028104bf673437da1baf889c7bbbae (diff)
downloadarchiva-45b308aab041fc4d0e4c198f32a1d4f57d366ed7.tar.gz
archiva-45b308aab041fc4d0e4c198f32a1d4f57d366ed7.zip
align maven api to use maven 3 version
temporary comment failing dependency tree git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134349 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-cli/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-artifact-converter/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/pom.xml5
-rw-r--r--archiva-modules/plugins/maven2-repository/pom.xml23
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java55
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java9
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java9
-rw-r--r--pom.xml26
9 files changed, 88 insertions, 49 deletions
diff --git a/archiva-cli/pom.xml b/archiva-cli/pom.xml
index 207b43da6..733299940 100644
--- a/archiva-cli/pom.xml
+++ b/archiva-cli/pom.xml
@@ -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>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
index c5ae11579..4c5373692 100644
--- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
+++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
@@ -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>
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
index cf774fe0d..8a155bc7c 100644
--- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/PlexusSisuBridge.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index b795ab84b..8c42cfc91 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -315,6 +315,11 @@
<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>
diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml
index 9b560c6b3..94eacf6f5 100644
--- a/archiva-modules/plugins/maven2-repository/pom.xml
+++ b/archiva-modules/plugins/maven2-repository/pom.xml
@@ -58,12 +58,23 @@
<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>
<exclusions>
@@ -93,16 +104,6 @@
<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>
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
index 758442715..44c4d7122 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
@@ -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()
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
index 963d4733c..73f843c65 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
@@ -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;
}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
index 943fcf7c0..5eaa390f8 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
@@ -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 6bd275e36..7e98aeb3c 100644
--- 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>
@@ -560,6 +559,16 @@
<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>
<version>1.1</version>
@@ -1066,24 +1075,13 @@
</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>