You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2009/12/01 17:01:33 UTC
svn commit: r885812 [1/2] - in /archiva/branches/MRM-1025: ./
archiva-modules/archiva-base/
archiva-modules/archiva-base/archiva-dependency-graph/
archiva-modules/archiva-web/archiva-webapp/
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/...
Author: brett
Date: Tue Dec 1 16:01:31 2009
New Revision: 885812
URL: http://svn.apache.org/viewvc?rev=885812&view=rev
Log:
[MRM-1292] replace the dependency graph by a maven-dependency-tree based implementation (maven-project is not used)
Added:
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/TestConfiguration.java
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/DependencyTreeTest.java
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/artifactId-version.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/child1-1.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/child2-1.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/child3-1.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/grandchild1-2.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/grandchild2-2.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/grandchild3-2.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/great-grandchild-3.0.pom
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/DependencyTreeTest.xml
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataResolver.java
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-components/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-components/1.1.12/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-components/1.1.12/plexus-components-1.1.12.pom
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-spring/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-spring/1.2/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus/1.0.10/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/repositories/test/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/commons-io/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/commons-io/commons-io/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/commons-io/commons-io/1.4/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/commons-io/commons-io/1.4/commons-io-1.4.pom
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/org/apache/archiva/dependency/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/org/apache/archiva/dependency/tree/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/org/apache/archiva/dependency/tree/maven2/
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/resources/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.xml
Removed:
archiva/branches/MRM-1025/archiva-modules/archiva-base/archiva-dependency-graph/
Modified:
archiva/branches/MRM-1025/archiva-modules/archiva-base/pom.xml
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/pom.xml
archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
archiva/branches/MRM-1025/pom.xml
Modified: archiva/branches/MRM-1025/archiva-modules/archiva-base/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-base/pom.xml?rev=885812&r1=885811&r2=885812&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-base/pom.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-base/pom.xml Tue Dec 1 16:01:31 2009
@@ -38,7 +38,6 @@
<module>archiva-consumers</module>
<module>archiva-indexer</module>
<module>archiva-model</module>
- <module>archiva-dependency-graph</module>
<module>archiva-repository-layer</module>
<module>archiva-xml-tools</module>
<module>archiva-proxy</module>
Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=885812&r1=885811&r2=885812&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/pom.xml Tue Dec 1 16:01:31 2009
@@ -31,10 +31,6 @@
<dependencies>
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>archiva-dependency-graph</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
<artifactId>archiva-report-manager</artifactId>
</dependency>
<dependency>
Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java?rev=885812&r1=885811&r2=885812&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTree.java Tue Dec 1 16:01:31 2009
@@ -23,63 +23,54 @@
import java.util.List;
import java.util.Stack;
-import javax.servlet.jsp.PageContext;
-
+import com.opensymphony.xwork2.ActionContext;
+import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.ArchivaException;
-import org.apache.maven.archiva.dependency.DependencyGraphFactory;
-import org.apache.maven.archiva.dependency.graph.DependencyGraph;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphEdge;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphNode;
-import org.apache.maven.archiva.dependency.graph.GraphTaskException;
-import org.apache.maven.archiva.dependency.graph.walk.BaseVisitor;
-import org.apache.maven.archiva.dependency.graph.walk.DependencyGraphWalker;
-import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
-import org.apache.maven.archiva.model.ArtifactReference;
-import org.apache.maven.archiva.model.DependencyScope;
import org.apache.maven.archiva.model.Keys;
-import org.apache.maven.archiva.model.VersionedReference;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.apache.maven.archiva.security.ArchivaXworkUser;
+import org.apache.maven.archiva.security.UserRepositories;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * DependencyTree
+ * DependencyTree
*
* @version $Id$
- *
- * @plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
+ * @plexus.component role="org.apache.maven.archiva.web.tags.DependencyTree"
*/
public class DependencyTree
- implements Initializable
{
private Logger log = LoggerFactory.getLogger( DependencyTree.class );
-
+
/**
- * @plexus.requirement
- * role="org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder"
- * role-hint="project-model"
+ * @plexus.requirement role-hint="maven2"
*/
- private DependencyGraphBuilder graphBuilder;
+ private DependencyTreeBuilder dependencyTreeBuilder;
- private DependencyGraphFactory graphFactory = new DependencyGraphFactory();
+ /**
+ * @plexus.requirement
+ */
+ private UserRepositories userRepositories;
- public class TreeEntry
+ public static class TreeEntry
{
private String pre = "";
private String post = "";
- private ArtifactReference artifact;
+ private Artifact artifact;
- public void setArtifact( ArtifactReference artifact )
+ public void setArtifact( Artifact artifact )
{
this.artifact = artifact;
}
- public ArtifactReference getArtifact()
+ public Artifact getArtifact()
{
return artifact;
}
@@ -89,21 +80,11 @@
return post;
}
- public void setPost( String post )
- {
- this.post = post;
- }
-
public String getPre()
{
return pre;
}
- public void setPre( String pre )
- {
- this.pre = pre;
- }
-
public void appendPre( String string )
{
this.pre += string;
@@ -115,59 +96,64 @@
}
}
- public List<TreeEntry> gatherTreeList( String groupId, String artifactId, String modelVersion, String nodevar,
- PageContext pageContext ) throws ArchivaException
+ public List<TreeEntry> gatherTreeList( String groupId, String artifactId, String modelVersion )
+ throws ArchivaException
{
if ( StringUtils.isBlank( groupId ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
- + "]: groupId is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
+ "]: groupId is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
if ( StringUtils.isBlank( artifactId ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
- + "]: artifactId is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
+ "]: artifactId is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
if ( StringUtils.isBlank( modelVersion ) )
{
- String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion )
- + "]: version is blank.";
+ String emsg = "Error generating dependency tree [" + Keys.toKey( groupId, artifactId, modelVersion ) +
+ "]: version is blank.";
log.error( emsg );
throw new ArchivaException( emsg );
}
- DependencyGraph graph = fetchGraph( groupId, artifactId, modelVersion );
+ // TODO Cache the results to disk, in XML format, in the same place as the artifact is located.
- if ( graph == null )
+ TreeListVisitor visitor = new TreeListVisitor();
+ try
+ {
+ dependencyTreeBuilder.buildDependencyTree( userRepositories.getObservableRepositoryIds( getPrincipal() ),
+ groupId, artifactId, modelVersion, visitor );
+ }
+ catch ( DependencyTreeBuilderException e )
{
- throw new ArchivaException( "Graph is unexpectedly null." );
+ throw new ArchivaException( "Unable to build dependency tree: " + e.getMessage(), e );
}
- TreeListVisitor treeListVisitor = new TreeListVisitor();
- DependencyGraphWalker walker = new WalkDepthFirstSearch();
- walker.visit( graph, treeListVisitor );
+ return visitor.getList();
+ }
- return treeListVisitor.getList();
+ private String getPrincipal()
+ {
+ return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
}
- class TreeListVisitor
- extends BaseVisitor
+ private static class TreeListVisitor
+ implements DependencyNodeVisitor
{
private List<TreeEntry> list;
- private int walkDepth;
+ private TreeEntry currentEntry;
- private int outputDepth;
+ boolean firstChild = true;
- private Stack<TreeEntry> entryStack = new Stack<TreeEntry>();
-
- private TreeEntry currentEntry;
+ private DependencyNode firstNode;
public TreeListVisitor()
{
@@ -179,86 +165,48 @@
return this.list;
}
- public void discoverGraph( DependencyGraph graph )
+ public boolean visit( DependencyNode node )
{
- super.discoverGraph( graph );
- this.list.clear();
- this.entryStack.clear();
- walkDepth = 0;
- outputDepth = -1;
- }
+ if ( firstNode == null )
+ {
+ firstNode = node;
+ }
- public void discoverNode( DependencyGraphNode node )
- {
- super.discoverNode( node );
currentEntry = new TreeEntry();
- while ( walkDepth > outputDepth )
+ if ( firstChild )
{
currentEntry.appendPre( "<ul>" );
- outputDepth++;
}
+
currentEntry.appendPre( "<li>" );
currentEntry.setArtifact( node.getArtifact() );
currentEntry.appendPost( "</li>" );
this.list.add( currentEntry );
- this.entryStack.push( currentEntry );
- }
-
- public void finishNode( DependencyGraphNode node )
- {
- super.finishNode( node );
- while ( walkDepth < outputDepth )
+ if ( !node.getChildren().isEmpty() )
{
- currentEntry.appendPost( "</ul>" );
- outputDepth--;
+ firstChild = true;
}
- this.entryStack.pop();
- }
-
- public void discoverEdge( DependencyGraphEdge edge )
- {
- super.discoverEdge( edge );
- walkDepth++;
+ return true;
}
- public void finishEdge( DependencyGraphEdge edge )
+ public boolean endVisit( DependencyNode node )
{
- super.finishEdge( edge );
- walkDepth--;
- }
- }
-
- private DependencyGraph fetchGraph( String groupId, String artifactId, String modelVersion )
- throws ArchivaException
- {
- // TODO Cache the results to disk, in XML format, in the same place as the artifact is located.
+ firstChild = false;
- VersionedReference projectRef = new VersionedReference();
- projectRef.setGroupId( groupId );
- projectRef.setArtifactId( artifactId );
- projectRef.setVersion( modelVersion );
+ if ( !node.getChildren().isEmpty() )
+ {
+ currentEntry.appendPost( "</ul>" );
+ }
- try
- {
- DependencyGraph depGraph = graphFactory.getGraph( projectRef );
+ if ( node == firstNode )
+ {
+ currentEntry.appendPost( "</ul>" );
+ }
- return depGraph;
- }
- catch ( GraphTaskException e )
- {
- String emsg = "Unable to generate graph for [" + Keys.toKey( projectRef ) + "] : " + e.getMessage();
- log.warn( emsg, e );
- throw new ArchivaException( emsg, e );
+ return true;
}
}
-
- public void initialize()
- throws InitializationException
- {
- this.graphFactory.setGraphBuilder( graphBuilder );
- this.graphFactory.setDesiredScope( DependencyScope.TEST );
- }
}
Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java?rev=885812&r1=885811&r2=885812&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java (original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java Tue Dec 1 16:01:31 2009
@@ -83,7 +83,7 @@
if ( treeIterator.hasNext() )
{
- currentTreeEntry = (TreeEntry) treeIterator.next();
+ currentTreeEntry = treeIterator.next();
out( currentTreeEntry.getPre() );
exposeVariables();
return EVAL_BODY_AGAIN;
@@ -132,7 +132,7 @@
out( "<div class=\"dependency-graph\">" );
try
{
- this.tree = deptree.gatherTreeList( groupId, artifactId, modelVersion, nodevar, pageContext );
+ this.tree = deptree.gatherTreeList( groupId, artifactId, modelVersion );
if ( CollectionUtils.isEmpty( this.tree ) )
{
@@ -141,7 +141,7 @@
treeIterator = tree.iterator();
- currentTreeEntry = (TreeEntry) treeIterator.next();
+ currentTreeEntry = treeIterator.next();
out( currentTreeEntry.getPre() );
exposeVariables();
}
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/TestConfiguration.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/TestConfiguration.java?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/TestConfiguration.java (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/configuration/TestConfiguration.java Tue Dec 1 16:01:31 2009
@@ -0,0 +1,64 @@
+package org.apache.archiva.configuration;
+
+/*
+ * 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 org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationListener;
+import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
+import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.plexus.registry.RegistryListener;
+
+public class TestConfiguration
+ implements ArchivaConfiguration
+{
+ private Configuration configuration;
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void save( Configuration configuration )
+ throws RegistryException, IndeterminateConfigurationException
+ {
+ this.configuration = configuration;
+ }
+
+ public boolean isDefaulted()
+ {
+ return false;
+ }
+
+ public void addListener( ConfigurationListener listener )
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeListener( ConfigurationListener listener )
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addChangeListener( RegistryListener listener )
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/DependencyTreeTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/DependencyTreeTest.java?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/DependencyTreeTest.java (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/tags/DependencyTreeTest.java Tue Dec 1 16:01:31 2009
@@ -0,0 +1,131 @@
+package org.apache.maven.archiva.web.tags;
+
+/*
+ * 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.util.List;
+
+import org.apache.archiva.metadata.model.ProjectVersionMetadata;
+import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
+import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
+
+public class DependencyTreeTest
+ extends PlexusInSpringTestCase
+{
+ private DependencyTree tree;
+
+ private ArtifactFactory artifactFactory;
+
+ private static final String TEST_VERSION = "version";
+
+ private static final String TEST_REPO_ID = "test-repo";
+
+ private static final String TEST_GROUP_ID = "groupId";
+
+ private static final String TEST_ARTIFACT_ID = "artifactId";
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ Configuration configuration = new Configuration();
+ ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
+ repoConfig.setId( TEST_REPO_ID );
+ repoConfig.setLocation( getTestPath( "src/test/repositories/test" ) );
+ configuration.addManagedRepository( repoConfig );
+
+ ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
+ archivaConfiguration.save( configuration );
+
+ tree = (DependencyTree) lookup( DependencyTree.class );
+
+ artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.class );
+
+ TestMetadataResolver metadataResolver = (TestMetadataResolver) lookup( MetadataResolver.class );
+ ProjectVersionMetadata metadata = new ProjectVersionMetadata();
+ metadata.setId( TEST_VERSION );
+ metadataResolver.setProjectVersion( TEST_REPO_ID, TEST_GROUP_ID, TEST_ARTIFACT_ID, metadata );
+ }
+
+ public void testTree()
+ throws ArchivaException
+ {
+ List<DependencyTree.TreeEntry> entries = tree.gatherTreeList( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION );
+ assertEquals( 8, entries.size() );
+
+ DependencyTree.TreeEntry artifactId = entries.get( 0 );
+ assertEquals( "<ul><li>", artifactId.getPre() );
+ assertEquals( createPomArtifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION ), artifactId.getArtifact() );
+ assertEquals( "</li>", artifactId.getPost() );
+
+ DependencyTree.TreeEntry child1 = entries.get( 1 );
+ assertEquals( "<ul><li>", child1.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "child1", "1.0" ), child1.getArtifact() );
+ assertEquals( "</li>", child1.getPost() );
+
+ DependencyTree.TreeEntry grandchild = entries.get( 2 );
+ assertEquals( "<ul><li>", grandchild.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "grandchild1", "2.0" ), grandchild.getArtifact() );
+ assertEquals( "</li>", grandchild.getPost() );
+
+ DependencyTree.TreeEntry greatGrandchild = entries.get( 3 );
+ assertEquals( "<ul><li>", greatGrandchild.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "great-grandchild", "3.0" ), greatGrandchild.getArtifact() );
+ assertEquals( "</li></ul></ul>", greatGrandchild.getPost() );
+
+ DependencyTree.TreeEntry child2 = entries.get( 4 );
+ assertEquals( "<li>", child2.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "child2", "1.0" ), child2.getArtifact() );
+ assertEquals( "</li>", child2.getPost() );
+
+ DependencyTree.TreeEntry grandchild2 = entries.get( 5 );
+ assertEquals( "<ul><li>", grandchild2.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "grandchild2", "2.0" ), grandchild2.getArtifact() );
+ assertEquals( "</li>", grandchild2.getPost() );
+
+ DependencyTree.TreeEntry grandchild3 = entries.get( 6 );
+ assertEquals( "<li>", grandchild3.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "grandchild3", "2.0" ), grandchild3.getArtifact() );
+ assertEquals( "</li></ul>", grandchild3.getPost() );
+
+ DependencyTree.TreeEntry child3 = entries.get( 7 );
+ assertEquals( "<li>", child3.getPre() );
+ assertEquals( createArtifact( TEST_GROUP_ID, "child3", "1.0" ), child3.getArtifact() );
+ assertEquals( "</li></ul></ul>", child3.getPost() );
+ }
+
+ private Artifact createPomArtifact( String groupId, String artifactId, String version )
+ {
+ return artifactFactory.createProjectArtifact( groupId, artifactId, version );
+ }
+
+ private Artifact createArtifact( String groupId, String artifactId, String version )
+ {
+ return artifactFactory.createBuildArtifact( groupId, artifactId, version, "jar" );
+ }
+}
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/artifactId-version.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/artifactId-version.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/artifactId-version.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/artifactId/version/artifactId-version.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,43 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>version</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>child1</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>child2</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>child3</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/child1-1.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/child1-1.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/child1-1.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child1/1.0/child1-1.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,33 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>child1</artifactId>
+ <version>1.0</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild1</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/child2-1.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/child2-1.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/child2-1.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child2/1.0/child2-1.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,37 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>child2</artifactId>
+ <version>1.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild2</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild3</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/child3-1.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/child3-1.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/child3-1.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/child3/1.0/child3-1.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>child3</artifactId>
+ <version>1.0</version>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/grandchild1-2.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/grandchild1-2.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/grandchild1-2.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild1/2.0/grandchild1-2.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,32 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild1</artifactId>
+ <version>2.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>great-grandchild</artifactId>
+ <version>3.0</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/grandchild2-2.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/grandchild2-2.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/grandchild2-2.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild2/2.0/grandchild2-2.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild2</artifactId>
+ <version>2.0</version>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/grandchild3-2.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/grandchild3-2.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/grandchild3-2.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/grandchild3/2.0/grandchild3-2.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>grandchild2</artifactId>
+ <version>2.0</version>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/great-grandchild-3.0.pom
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/great-grandchild-3.0.pom?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/great-grandchild-3.0.pom (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/repositories/test/groupId/great-grandchild/3.0/great-grandchild-3.0.pom Tue Dec 1 16:01:31 2009
@@ -0,0 +1,26 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>great-grandchild</artifactId>
+ <version>3.0</version>
+ <packaging>pom</packaging>
+</project>
\ No newline at end of file
Added: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/DependencyTreeTest.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/DependencyTreeTest.xml?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/DependencyTreeTest.xml (added)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/tags/DependencyTreeTest.xml Tue Dec 1 16:01:31 2009
@@ -0,0 +1,39 @@
+<!--
+ ~ 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.
+ -->
+
+<plexus>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.security.UserRepositories</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
+ </component>
+ <component>
+ <role>org.apache.archiva.metadata.repository.MetadataResolver</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.archiva.metadata.repository.memory.TestMetadataResolver</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.archiva.configuration.TestConfiguration</implementation>
+ </component>
+ </components>
+</plexus>
Modified: archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/pom.xml?rev=885812&r1=885811&r2=885812&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/pom.xml (original)
+++ archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/pom.xml Tue Dec 1 16:01:31 2009
@@ -55,6 +55,21 @@
<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.shared</groupId>
+ <artifactId>maven-dependency-tree</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
Added: archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java (added)
+++ archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java Tue Dec 1 16:01:31 2009
@@ -0,0 +1,445 @@
+package org.apache.archiva.dependency.tree.maven2;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.MetadataResolverException;
+import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
+import org.apache.archiva.metadata.repository.storage.maven2.RepositoryModelResolver;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+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.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.ManagedVersionMap;
+import org.apache.maven.artifact.versioning.VersionRange;
+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.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.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+import org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener;
+import org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.StateDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/**
+ * Default implementation of <code>DependencyTreeBuilder</code>. Customized wrapper for maven-dependency-tree to use
+ * maven-model-builder instead of maven-project. Note that the role must differ to avoid conflicting with the
+ * maven-shared implementation.
+ *
+ * @plexus.component role="org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder" role-hint="maven2"
+ */
+public class DefaultDependencyTreeBuilder
+ extends AbstractLogEnabled
+ implements DependencyTreeBuilder
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArtifactFactory factory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArtifactCollector collector;
+
+ /**
+ * @plexus.requirement
+ */
+ private ModelBuilder builder;
+
+ /**
+ * @plexus.requirement
+ */
+ private MetadataResolver metadataResolver;
+
+ /**
+ * @plexus.requirement role-hint="maven2"
+ */
+ private RepositoryPathTranslator pathTranslator;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaConfiguration archivaConfiguration;
+
+ public void buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId, String version,
+ DependencyNodeVisitor nodeVisitor )
+ throws DependencyTreeBuilderException
+ {
+ DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener( getLogger() );
+
+ Artifact projectArtifact = factory.createProjectArtifact( groupId, artifactId, version );
+ File basedir = findArtifactInRepositories( repositoryIds, projectArtifact );
+
+ if ( basedir == null )
+ {
+ // metadata could not be resolved
+ return;
+ }
+
+ try
+ {
+ Model model =
+ buildProject( new RepositoryModelResolver( basedir, pathTranslator ), groupId, artifactId, version );
+
+ Map managedVersions = createManagedVersionMap( model );
+
+ Set<Artifact> dependencyArtifacts = createArtifacts( model, null );
+
+ ArtifactMetadataSource metadataSource = new MetadataArtifactMetadataSource( repositoryIds );
+
+ // 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 ) );
+
+ DependencyNode rootNode = listener.getRootNode();
+
+ // TODO: remove the need for this when the serializer can calculate last nodes from visitor calls only
+ DependencyNodeVisitor visitor = new BuildingDependencyNodeVisitor( nodeVisitor );
+
+ CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
+ DependencyNodeVisitor firstPassVisitor =
+ new FilteringDependencyNodeVisitor( collectingVisitor, StateDependencyNodeFilter.INCLUDED );
+ rootNode.accept( firstPassVisitor );
+
+ DependencyNodeFilter secondPassFilter =
+ new AncestorOrSelfDependencyNodeFilter( collectingVisitor.getNodes() );
+ visitor = new FilteringDependencyNodeVisitor( visitor, secondPassFilter );
+
+ rootNode.accept( visitor );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new DependencyTreeBuilderException( "Cannot build project dependency tree " + e.getMessage(), e );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new DependencyTreeBuilderException( "Invalid dependency version for artifact " + projectArtifact );
+ }
+ catch ( ModelBuildingException e )
+ {
+ throw new DependencyTreeBuilderException( "Cannot build project dependency tree " + e.getMessage(), e );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ throw new DependencyTreeBuilderException( "Cannot build project dependency tree " + e.getMessage(), e );
+ }
+ }
+
+ private File findArtifactInRepositories( List<String> repositoryIds, Artifact projectArtifact )
+ {
+ for ( String repoId : repositoryIds )
+ {
+ ManagedRepositoryConfiguration repositoryConfiguration =
+ archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
+
+ File repoDir = new File( repositoryConfiguration.getLocation() );
+ File file = pathTranslator.toFile( repoDir, projectArtifact.getGroupId(), projectArtifact.getArtifactId(),
+ projectArtifact.getBaseVersion(),
+ projectArtifact.getArtifactId() + "-" + projectArtifact.getVersion() +
+ ".pom" );
+
+ if ( file.exists() )
+ {
+ return repoDir;
+ }
+ }
+ return null;
+ }
+
+ private Model buildProject( RepositoryModelResolver modelResolver, String groupId, String artifactId,
+ String version )
+ throws ModelBuildingException, UnresolvableModelException
+ {
+ ModelBuildingRequest req = new DefaultModelBuildingRequest();
+ req.setProcessPlugins( false );
+ req.setModelSource( modelResolver.resolveModel( groupId, artifactId, version ) );
+ req.setModelResolver( modelResolver );
+ req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
+
+ return builder.build( req ).getEffectiveModel();
+ }
+
+ // from maven-project to avoid the dependency on it
+ private Set<Artifact> createArtifacts( Model model, ArtifactFilter dependencyFilter )
+ throws InvalidVersionSpecificationException
+ {
+ Collection<Dependency> dependencies = model.getDependencies();
+ Set<Artifact> projectArtifacts = new LinkedHashSet<Artifact>( dependencies.size() );
+
+ for ( Dependency dependency : dependencies )
+ {
+ String scope = dependency.getScope();
+
+ if ( StringUtils.isEmpty( scope ) )
+ {
+ scope = Artifact.SCOPE_COMPILE;
+
+ dependency.setScope( scope );
+ }
+
+ VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
+ Artifact artifact =
+ factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
+ dependency.getType(), dependency.getClassifier(), scope, null,
+ dependency.isOptional() );
+
+ if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
+ {
+ artifact.setFile( new File( dependency.getSystemPath() ) );
+ }
+
+ ArtifactFilter artifactFilter = dependencyFilter;
+
+ // MNG-3769: It would be nice to be able to process relocations here,
+ // so we could have this filtering step apply to post-relocated dependencies.
+ // HOWEVER, this would require a much more invasive POM resolution process
+ // in order to look for relocations, which would make the early steps in
+ // a Maven build way too heavy.
+ if ( artifact != null && ( artifactFilter == null || artifactFilter.include( artifact ) ) )
+ {
+ if ( dependency.getExclusions() != null && !dependency.getExclusions().isEmpty() )
+ {
+ List<String> exclusions = new ArrayList<String>();
+ for ( Object o : dependency.getExclusions() )
+ {
+ Exclusion e = (Exclusion) o;
+ exclusions.add( e.getGroupId() + ":" + e.getArtifactId() );
+ }
+
+ ArtifactFilter newFilter = new ExcludesArtifactFilter( exclusions );
+
+ if ( artifactFilter != null )
+ {
+ AndArtifactFilter filter = new AndArtifactFilter();
+ filter.add( artifactFilter );
+ filter.add( newFilter );
+ artifactFilter = filter;
+ }
+ else
+ {
+ artifactFilter = newFilter;
+ }
+ }
+
+ artifact.setDependencyFilter( artifactFilter );
+
+ projectArtifacts.add( artifact );
+ }
+ }
+
+ return projectArtifacts;
+
+ }
+
+ // from maven-project to avoid the dependency on it
+
+ private Map createManagedVersionMap( Model model )
+ throws InvalidVersionSpecificationException
+ {
+ DependencyManagement dependencyManagement = model.getDependencyManagement();
+
+ Map<String, Artifact> map = null;
+ List<Dependency> deps;
+ if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) &&
+ ( deps.size() > 0 ) )
+ {
+ map = new ManagedVersionMap( map );
+
+ for ( Dependency dependency : dependencyManagement.getDependencies() )
+ {
+
+ VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
+
+ Artifact artifact =
+ factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
+ dependency.getType(), dependency.getClassifier(),
+ dependency.getScope(), dependency.isOptional() );
+ if ( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( " " + artifact );
+ }
+
+ // If the dependencyManagement section listed exclusions,
+ // add them to the managed artifacts here so that transitive
+ // dependencies will be excluded if necessary.
+ if ( ( null != dependency.getExclusions() ) && !dependency.getExclusions().isEmpty() )
+ {
+ List<String> exclusions = new ArrayList<String>();
+
+ for ( Exclusion exclusion : dependency.getExclusions() )
+ {
+ exclusions.add( exclusion.getGroupId() + ":" + exclusion.getArtifactId() );
+ }
+ ExcludesArtifactFilter eaf = new ExcludesArtifactFilter( exclusions );
+ artifact.setDependencyFilter( eaf );
+ }
+ else
+ {
+ artifact.setDependencyFilter( null );
+ }
+ map.put( dependency.getManagementKey(), artifact );
+ }
+ }
+ else
+ {
+ map = Collections.emptyMap();
+ }
+
+ return map;
+ }
+
+ private class MetadataArtifactMetadataSource
+ implements ArtifactMetadataSource
+ {
+ private final List<String> repositoryIds;
+
+ public MetadataArtifactMetadataSource( List<String> repositoryIds )
+ {
+ this.repositoryIds = repositoryIds;
+ }
+
+ // modified version from MavenMetadataSource to work with the simpler environment
+ public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
+ List remoteRepositories )
+ throws ArtifactMetadataRetrievalException
+ {
+ // TODO: we removed relocation support here. This is something that might need to be generically handled
+ // throughout this module
+
+ Artifact pomArtifact =
+ factory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ artifact.getScope() );
+
+ File basedir = findArtifactInRepositories( repositoryIds, pomArtifact );
+
+ Model project = null;
+ if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) && basedir != null )
+ {
+ try
+ {
+ project =
+ buildProject( new RepositoryModelResolver( basedir, pathTranslator ), artifact.getGroupId(),
+ artifact.getArtifactId(), artifact.getVersion() );
+ }
+ catch ( ModelBuildingException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
+ }
+ }
+
+ ResolutionGroup result;
+
+ if ( project == null )
+ {
+ // TODO: we could record this so that it is displayed in the dependency tree as (...) or similar
+
+ // 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() );
+ }
+ else
+ {
+ Set artifacts = Collections.emptySet();
+ if ( !artifact.getArtifactHandler().isIncludesDependencies() )
+ {
+ try
+ {
+ artifacts = createArtifacts( project, artifact.getDependencyFilter() );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
+ }
+ }
+
+ result = new ResolutionGroup( pomArtifact, artifacts, Collections.emptyList() );
+ }
+
+ return result;
+ }
+
+ public List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
+ List remoteRepositories )
+ throws ArtifactMetadataRetrievalException
+ {
+ try
+ {
+ Set<ArtifactVersion> versions = new HashSet<ArtifactVersion>();
+ for ( String repoId : repositoryIds )
+ {
+ Collection<String> projectVersions =
+ metadataResolver.getProjectVersions( repoId, artifact.getGroupId(), artifact.getArtifactId() );
+ for ( String version : projectVersions )
+ {
+ versions.add( new DefaultArtifactVersion( version ) );
+ }
+ }
+
+ return new ArrayList<ArtifactVersion>( versions );
+ }
+ catch ( MetadataResolverException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
+ }
+ }
+ }
+}
Added: archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java?rev=885812&view=auto
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java (added)
+++ archiva/branches/MRM-1025/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilder.java Tue Dec 1 16:01:31 2009
@@ -0,0 +1,47 @@
+package org.apache.archiva.dependency.tree.maven2;
+
+/*
+ * 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.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;
+
+/**
+ * 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.
+ */
+public interface DependencyTreeBuilder
+{
+ /**
+ * Builds a tree of dependencies for the specified Maven project.
+ *
+ * @param repositoryIds the list of repositories to search for metadata
+ * @param groupId the project groupId to build the tree for
+ * @param artifactId the project artifactId to build the tree for
+ * @param version the project version to build the tree for
+ * @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 )
+ throws DependencyTreeBuilderException;
+}