You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/04/22 21:27:58 UTC
svn commit: r767628 -
/maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
Author: jdcasey
Date: Wed Apr 22 19:27:57 2009
New Revision: 767628
URL: http://svn.apache.org/viewvc?rev=767628&view=rev
Log:
[MNG-4074] Fix case where a build plugin (not from pluginManagement) has a dependency, then that plugin definition is inherited down to the dependency project itself. This is a cyclic reference from a project to itself.
Modified:
maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
Modified: maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java?rev=767628&r1=767627&r2=767628&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java (original)
+++ maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java Wed Apr 22 19:27:57 2009
@@ -156,16 +156,27 @@
if ( dag.getVertex( dependencyId ) != null )
{
- project.addProjectReference( (MavenProject) projectMap.get( dependencyId ) );
-
- addEdgeWithParentCheck( projectMap, dependencyId, project, id );
-
- // TODO: Shouldn't we add an edge between the plugin and its dependency?
- // Note that doing this may result in cycles...run
- // ProjectSorterTest.testPluginDependenciesInfluenceSorting_DeclarationInParent()
- // for more information, if you change this:
-
- // dag.addEdge( pluginId, dependencyId );
+ // If the plugin in which this dependency is listed is actually used here,
+ // it will probably be stuck using an older version of this project that
+ // already exists in the local repository. If not yet installed, it is
+ // likely that we'll get an ArtifactNotFoundException when this plugin
+ // is executed to build this project.
+ //
+ // If the plugin is NOT actually used here, it may actually belong in the
+ // pluginManagement section.
+ if ( !id.equals( dependencyId ) )
+ {
+ project.addProjectReference( (MavenProject) projectMap.get( dependencyId ) );
+
+ addEdgeWithParentCheck( projectMap, dependencyId, project, id );
+
+ // TODO: Shouldn't we add an edge between the plugin and its dependency?
+ // Note that doing this may result in cycles...run
+ // ProjectSorterTest.testPluginDependenciesInfluenceSorting_DeclarationInParent()
+ // for more information, if you change this:
+
+ // dag.addEdge( pluginId, dependencyId );
+ }
}
}
}