maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r767940 - in /maven/components/branches/maven-2.2.x: ./ apache-maven/ apache-maven/src/test/ maven-core/src/main/java/org/apache/maven/plugin/ maven-integration-tests/ maven-model/src/test/ maven-project/src/main/java/org/apache/maven/proje...
Date Thu, 23 Apr 2009 15:11:19 GMT
Author: jdcasey
Date: Thu Apr 23 15:11:18 2009
New Revision: 767940

URL: http://svn.apache.org/viewvc?rev=767940&view=rev
Log:
merging to r767631 from maven-2.1.x branch for MNG-4074

Modified:
    maven/components/branches/maven-2.2.x/   (props changed)
    maven/components/branches/maven-2.2.x/apache-maven/   (props changed)
    maven/components/branches/maven-2.2.x/apache-maven/src/test/   (props changed)
    maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java
  (props changed)
    maven/components/branches/maven-2.2.x/maven-integration-tests/   (props changed)
    maven/components/branches/maven-2.2.x/maven-model/src/test/   (props changed)
    maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
    maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/ProjectSorterTest.java
    maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java
  (props changed)

Propchange: maven/components/branches/maven-2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -2,6 +2,6 @@
 /maven/components/branches/maven-2.0.x:679552-679867,693956-728820,728836,728940,729060,729738,729785,730461,730631,734502,734803,736543,746381
 /maven/components/branches/maven-2.1.0-M1-RC:690315,691793-694304
 /maven/components/branches/maven-2.1.0-RC:688883,689695,689976,689990,752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x:751686
+/maven/components/branches/maven-2.1.x:751686,767628,767631
 /maven/components/trunk:572229,720001,721902,726845,729292
 /maven/sandbox/branches/maven/MNG-3379:678167

Propchange: maven/components/branches/maven-2.2.x/apache-maven/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -2,7 +2,7 @@
 /maven/components/branches/maven-2.0.x/apache-maven:533160,636838,649903,657432,659677,679552-679867,693956-728820,728836,728940,736543,746038
 /maven/components/branches/maven-2.1.0-M1-RC/apache-maven:690315,691793-694304
 /maven/components/branches/maven-2.1.0-RC/apache-maven:688883,689695,689976,689990,752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x/apache-maven:751686
+/maven/components/branches/maven-2.1.x/apache-maven:751686,767628,767631
 /maven/components/trunk/apache-maven:720001,721902,726845,727688
 /maven/components/trunk/maven-distribution:727688
 /maven/sandbox/branches/maven/MNG-3379/apache-maven:678167

Propchange: maven/components/branches/maven-2.2.x/apache-maven/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -1,4 +1,4 @@
 /maven/components/branches/maven-2.0.10-RC/apache-maven/src/test:728834
 /maven/components/branches/maven-2.0.x/apache-maven/src/test:736543
 /maven/components/branches/maven-2.1.0-RC/apache-maven/src/test:752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x/apache-maven/src/test:751686
+/maven/components/branches/maven-2.1.x/apache-maven/src/test:751686,767628,767631

Propchange: maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -4,5 +4,6 @@
 /maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java:688883,689695,689976,689990
 /maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java:752168,752622,752653,753320,755199,755215
 /maven/components/branches/maven-2.1.x/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java:751686,753648,754505,754542
+/maven/components/branches/maven-2.1.x/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java:767628,767631
 /maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java:572229,720001,721902,726845,729292
 /maven/sandbox/branches/maven/MNG-3379/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java:678167

Propchange: maven/components/branches/maven-2.2.x/maven-integration-tests/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -1,4 +1,4 @@
 /maven/components/branches/maven-2.0.10-RC/maven-integration-tests:728834
 /maven/components/branches/maven-2.0.x/maven-integration-tests:736543
 /maven/components/branches/maven-2.1.0-RC/maven-integration-tests:752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x/maven-integration-tests:751686
+/maven/components/branches/maven-2.1.x/maven-integration-tests:751686,767628,767631

Propchange: maven/components/branches/maven-2.2.x/maven-model/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -1,4 +1,4 @@
 /maven/components/branches/maven-2.0.10-RC/maven-model/src/test:728834
 /maven/components/branches/maven-2.0.x/maven-model/src/test:736543
 /maven/components/branches/maven-2.1.0-RC/maven-model/src/test:752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x/maven-model/src/test:751686
+/maven/components/branches/maven-2.1.x/maven-model/src/test:751686,767628,767631

Modified: maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java?rev=767940&r1=767939&r2=767940&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
(original)
+++ maven/components/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/ProjectSorter.java
Thu Apr 23 15:11:18 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 );
+                              }
                           }
                        }
                     }

Modified: maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/ProjectSorterTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/ProjectSorterTest.java?rev=767940&r1=767939&r2=767940&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/ProjectSorterTest.java
(original)
+++ maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/ProjectSorterTest.java
Thu Apr 23 15:11:18 2009
@@ -26,6 +26,7 @@
 import org.apache.maven.model.Extension;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 import java.util.ArrayList;
@@ -35,7 +36,7 @@
 
 /**
  * Test sorting projects by dependencies.
- *
+ * 
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
  */
@@ -49,22 +50,22 @@
         MavenProject project = createProject( "group", "artifactA", "1.0" );
 
         List projects = new ProjectSorter( Collections.singletonList( project ) ).getSortedProjects();
-        
+
         assertEquals( "Wrong number of projects: " + projects, 1, projects.size() );
         assertEquals( "Didn't match project", project, projects.get( 0 ) );
     }
-    
+
     public void testBasicMultiProject()
         throws CycleDetectedException, DuplicateProjectException, MissingProjectException
     {
         MavenProject projectA = createProject( "group", "artifactA", "1.0" );
         MavenProject projectB = createProject( "group", "artifactB", "1.0" );
         MavenProject projectC = createProject( "group", "artifactC", "1.0" );
-        
+
         projectA.getDependencies().add( createDependency( projectB ) );
         projectB.getDependencies().add( createDependency( projectC ) );
-        
-        List projects = Arrays.asList( new Object[] { projectA, projectB, projectC} );
+
+        List projects = Arrays.asList( new Object[] { projectA, projectB, projectC } );
 
         projects = new ProjectSorter( projects ).getSortedProjects();
 
@@ -145,7 +146,8 @@
         List projects = Arrays.asList( new Object[] { projectA, projectB, projectC } );
         List selectedProjects = Arrays.asList( new Object[] { "group:artifactB" } );
 
-        projects = new ProjectSorter( projects, selectedProjects, null, false/* make */,
true/*makeDependents*/ ).getSortedProjects();
+        projects =
+            new ProjectSorter( projects, selectedProjects, null, false/* make */, true/*
makeDependents */).getSortedProjects();
 
         assertEquals( "Wrong number of projects: " + projects, 2, projects.size() );
         assertEquals( "Didn't match project", projectB, projects.get( 0 ) );
@@ -178,32 +180,100 @@
         assertEquals( "Didn't match project", projectE, projects.get( 2 ) );
         assertEquals( "Didn't match project", projectD, projects.get( 3 ) );
     }
-    
-    public void testShouldNotFailWhenProjectReferencesNonExistentProject()
+
+    public void testShouldNotFailWhenPluginDepReferencesCurrentProject()
         throws CycleDetectedException, DuplicateProjectException, MissingProjectException
     {
         MavenProject project = createProject( "group", "artifact", "1.0" );
         Model model = project.getModel();
-        
+
         Build build = model.getBuild();
-        
+
+        if ( build == null )
+        {
+            build = new Build();
+            model.setBuild( build );
+        }
+
+        Plugin plugin = new Plugin();
+
+        plugin.setArtifactId( "other-artifact" );
+        plugin.setGroupId( "other.group" );
+        plugin.setVersion( "1.0" );
+
+        Dependency dep = new Dependency();
+        dep.setGroupId( "group" );
+        dep.setArtifactId( "artifact" );
+        dep.setVersion( "1.0" );
+
+        plugin.addDependency( dep );
+
+        build.addPlugin( plugin );
+
+        new ProjectSorter( Collections.singletonList( project ) );
+    }
+
+    public void testShouldNotFailWhenManagedPluginDepReferencesCurrentProject()
+        throws CycleDetectedException, DuplicateProjectException, MissingProjectException
+    {
+        MavenProject project = createProject( "group", "artifact", "1.0" );
+        Model model = project.getModel();
+
+        Build build = model.getBuild();
+
         if ( build == null )
         {
             build = new Build();
             model.setBuild( build );
         }
         
-        Extension extension = new Extension();
+        PluginManagement pMgmt = new PluginManagement();
+
+        Plugin plugin = new Plugin();
+
+        plugin.setArtifactId( "other-artifact" );
+        plugin.setGroupId( "other.group" );
+        plugin.setVersion( "1.0" );
+
+        Dependency dep = new Dependency();
+        dep.setGroupId( "group" );
+        dep.setArtifactId( "artifact" );
+        dep.setVersion( "1.0" );
+
+        plugin.addDependency( dep );
+
+        pMgmt.addPlugin( plugin );
         
+        build.setPluginManagement( pMgmt );
+
+        new ProjectSorter( Collections.singletonList( project ) );
+    }
+
+    public void testShouldNotFailWhenProjectReferencesNonExistentProject()
+        throws CycleDetectedException, DuplicateProjectException, MissingProjectException
+    {
+        MavenProject project = createProject( "group", "artifact", "1.0" );
+        Model model = project.getModel();
+
+        Build build = model.getBuild();
+
+        if ( build == null )
+        {
+            build = new Build();
+            model.setBuild( build );
+        }
+
+        Extension extension = new Extension();
+
         extension.setArtifactId( "other-artifact" );
         extension.setGroupId( "other.group" );
         extension.setVersion( "1.0" );
-        
+
         build.addExtension( extension );
-        
+
         new ProjectSorter( Collections.singletonList( project ) );
     }
-    
+
     public void testMatchingArtifactIdsDifferentGroupIds()
         throws CycleDetectedException, DuplicateProjectException, MissingProjectException
     {
@@ -245,7 +315,7 @@
         MavenProject project2 = createProject( "groupId", "artifactId", "1.0" );
         projects.add( project2 );
 
-        try 
+        try
         {
             projects = new ProjectSorter( projects ).getSortedProjects();
             fail( "Duplicate projects should fail" );
@@ -266,7 +336,7 @@
         MavenProject project2 = createProject( "groupId", "artifactId", "2.0" );
         projects.add( project2 );
 
-        try 
+        try
         {
             projects = new ProjectSorter( projects ).getSortedProjects();
             fail( "Duplicate projects should fail" );
@@ -317,13 +387,13 @@
         build.addPlugin( plugin );
 
         projects = new ProjectSorter( projects ).getSortedProjects();
-        
+
         assertEquals( parentProject, projects.get( 0 ) );
-        
+
         // the order of these two is non-deterministic, based on when they're added to the
reactor.
         assertTrue( projects.contains( pluginProject ) );
         assertTrue( projects.contains( pluginLevelDepProject ) );
-        
+
         // the declaring project MUST be listed after the plugin and its plugin-level dep,
though.
         assertEquals( declaringProject, projects.get( 3 ) );
     }
@@ -363,11 +433,11 @@
         build.addPlugin( plugin );
 
         projects = new ProjectSorter( projects ).getSortedProjects();
-        
+
         System.out.println( projects );
 
         assertEquals( parentProject, projects.get( 0 ) );
-        
+
         // the order of these two is non-deterministic, based on when they're added to the
reactor.
         assertTrue( projects.contains( pluginProject ) );
         assertTrue( projects.contains( pluginLevelDepProject ) );

Propchange: maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 23 15:11:18 2009
@@ -1,4 +1,4 @@
 /maven/components/branches/maven-2.0.10-RC/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java:688259,725329-725330,725342,725349,725359
 /maven/components/branches/maven-2.1.0-M1-RC/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java:690315,691793
 /maven/components/branches/maven-2.1.0-RC/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java:688883,689695,689976,689990,752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
-/maven/components/branches/maven-2.1.x/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java:751686
+/maven/components/branches/maven-2.1.x/maven-project/src/test/java/org/apache/maven/project/interpolation/AbstractModelInterpolatorTest.java:751686,767628,767631



Mime
View raw message