maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r543649 - in /maven/components/branches/maven-2.0.x/maven-project/src: main/java/org/apache/maven/project/ test/java/org/apache/maven/project/ test/resources/projects/grandchild-check/ test/resources/projects/grandchild-check/child/ test/re...
Date Fri, 01 Jun 2007 22:31:24 GMT
Author: jdcasey
Date: Fri Jun  1 15:31:22 2007
New Revision: 543649

URL: http://svn.apache.org/viewvc?view=rev&rev=543649
Log:
[MNG-2619] applied patch to fix the middle-pom problem.

Added:
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
  (with props)
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
  (with props)
    maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
  (with props)
Modified:
    maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java

Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?view=diff&rev=543649&r1=543648&r2=543649
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Fri Jun  1 15:31:22 2007
@@ -741,8 +741,6 @@
             }
         }
 
-        Model originalModel = ModelUtils.cloneModel( model );
-
         MavenProject project = null;
         try
         {
@@ -754,11 +752,6 @@
             throw new ProjectBuildingException( projectId, e.getMessage(), e );
         }
 
-        project.setOriginalModel( originalModel );
-
-        rawProjectCache.put( createCacheKey( project.getGroupId(), project.getArtifactId(),
project.getVersion() ),
-                             new MavenProject( project ) );
-
         // we don't have to force the collision exception for superModel here, it's already
been done in getSuperModel()
         MavenProject previousProject = superProject;
 
@@ -1034,6 +1027,9 @@
                                           boolean strict )
         throws ProjectBuildingException, InvalidRepositoryException
     {
+        Model originalModel = ModelUtils.cloneModel( model );
+
+
         if ( !model.getRepositories().isEmpty() )
         {
             List respositories = buildArtifactRepositories( model );
@@ -1089,7 +1085,8 @@
         MavenProject project = new MavenProject( model );
 
         project.setActiveProfiles( activeProfiles );
-
+        project.setOriginalModel( originalModel );
+        
         lineage.addFirst( project );
 
         Parent parentModel = model.getParent();
@@ -1288,6 +1285,8 @@
 
             project.setParentArtifact( parentArtifact );
         }
+
+        rawProjectCache.put( createCacheKey( project.getGroupId(), project.getArtifactId(),
project.getVersion() ), new MavenProject( project ) );
 
         return project;
     }

Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?view=diff&rev=543649&r1=543648&r2=543649
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
(original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
Fri Jun  1 15:31:22 2007
@@ -32,26 +32,21 @@
 import org.apache.maven.model.Repository;
 import org.apache.maven.profiles.DefaultProfileManager;
 import org.apache.maven.profiles.ProfileManager;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 
 public class DefaultMavenProjectBuilderTest
-    extends PlexusTestCase
+    extends AbstractMavenProjectTestCase
 {
 
     private List filesToDelete = new ArrayList();
 
     private File localRepoDir;
 
-    private DefaultMavenProjectBuilder projectBuilder;
-
     public void setUp()
         throws Exception
     {
         super.setUp();
 
-        projectBuilder = (DefaultMavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
-        
         localRepoDir = new File( System.getProperty( "java.io.tmpdir" ), "local-repo." +
System.currentTimeMillis() );
         localRepoDir.mkdirs();
 
@@ -150,6 +145,22 @@
                       ( (Repository) repositories.get( 0 ) ).getId() );
     }
 
+    /**
+     * Check that we can build ok from the middle pom of a (parent,child,grandchild) heirarchy
+     * @throws Exception 
+     */
+    public void testBuildFromMiddlePom() throws Exception
+    {
+        File f1 = getTestFile( "src/test/resources/projects/grandchild-check/child/pom.xml");
+        File f2 = getTestFile( "src/test/resources/projects/grandchild-check/child/grandchild/pom.xml");
+
+        getProject( f1 );
+        
+        // it's the building of the grandchild project, having already cached the child project
+        // (but not the parent project), which causes the problem.
+        getProject( f2 );
+    }
+    
     protected ArtifactRepository getLocalRepository()
         throws Exception
     {

Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml?view=auto&rev=543649
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
(added)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
Fri Jun  1 15:31:22 2007
@@ -0,0 +1,10 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+	<groupId>grandchildtest</groupId>
+	<artifactId>child</artifactId>
+	<version>1</version>
+	</parent>
+	<artifactId>grandchild</artifactId>
+
+</project>

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/grandchild/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml?view=auto&rev=543649
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
(added)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
Fri Jun  1 15:31:22 2007
@@ -0,0 +1,13 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+	<groupId>grandchildtest</groupId>
+	<artifactId>root-pom</artifactId>
+	<version>1</version>
+	</parent>
+	<artifactId>child</artifactId>
+	<packaging>pom</packaging>
+  <modules>
+    <module>grandchild</module>
+  </modules>
+</project>

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/child/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml?view=auto&rev=543649
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
(added)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
Fri Jun  1 15:31:22 2007
@@ -0,0 +1,7 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>grandchildtest</groupId>
+	<artifactId>root-pom</artifactId>
+	<version>1</version>
+	<packaging>pom</packaging>
+</project>

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/grandchild-check/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message