mirror of https://github.com/apache/maven.git
(Merged from 384104.) [MNG-2130] Re-adding the cache check for parent POMs in assembleLineage(..) when building in a multimodule scenario (if they're part of the same build, but not yet in the local repo) before checking the parent's relativePath value or hitting the repository system to look for them.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@384108 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55dc9e4ccb
commit
d69fe06e8d
|
@ -265,6 +265,9 @@ it0097: Test that the implied relative path for the parent POM works, even two
|
|||
|
||||
it0098: Test that quoted system properties are processed correctly. [MNG-1415]
|
||||
|
||||
it0099: Test that parent-POMs cached during a build are available as parents
|
||||
to other POMs in the multimodule build. [MNG-2124]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
- generated sources
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
it0099
|
||||
it0098
|
||||
it0097
|
||||
it0096
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.it0099</groupId>
|
||||
<artifactId>maven-it0099-parent</artifactId>
|
||||
<version>1</version>
|
||||
</parent>
|
||||
<artifactId>maven-it0099-child</artifactId>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
package
|
|
@ -0,0 +1,12 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.it0099</groupId>
|
||||
<artifactId>maven-it0099-parent</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>child</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
rm ${artifact:org.apache.maven.it0099:maven-it0099-parent:1:pom}
|
|
@ -690,10 +690,13 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
Model previous = superProject.getModel();
|
||||
|
||||
// System.out.println( "Assembling inheritance..." );
|
||||
|
||||
for ( Iterator i = lineage.iterator(); i.hasNext(); )
|
||||
{
|
||||
MavenProject currentProject = (MavenProject) i.next();
|
||||
|
||||
// System.out.println( "Assembling inheritance: " + previousProject.getId() + "(" + previousProject.getName() + ")" + " <- " + currentProject.getId() + "(" + currentProject.getName() + ")" );
|
||||
Model current = currentProject.getModel();
|
||||
|
||||
String pathAdjustment = null;
|
||||
|
@ -711,6 +714,8 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
previous = current;
|
||||
previousProject = currentProject;
|
||||
|
||||
// System.out.println( "New parent project is: " + previousProject.getId() + "(" + previousProject.getName() + ")" );
|
||||
}
|
||||
|
||||
// only add the super repository if it wasn't overridden by a profile or project
|
||||
|
@ -995,11 +1000,23 @@ public class DefaultMavenProjectBuilder
|
|||
throw new ProjectBuildingException( projectId, "Missing version element from parent element" );
|
||||
}
|
||||
|
||||
String parentKey = createCacheKey( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() );
|
||||
MavenProject parentProject = (MavenProject)projectCache.get( parentKey );
|
||||
|
||||
// the only way this will have a value is if we find the parent on disk...
|
||||
File parentDescriptor = null;
|
||||
|
||||
model = null;
|
||||
|
||||
|
||||
if ( parentProject != null )
|
||||
{
|
||||
model = parentProject.getOriginalModel();
|
||||
|
||||
parentDescriptor = parentProject.getFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
model = null;
|
||||
}
|
||||
|
||||
String parentRelativePath = parentModel.getRelativePath();
|
||||
|
||||
// if we can't find a cached model matching the parent spec, then let's try to look on disk using
|
||||
|
@ -1108,14 +1125,16 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
parentProjectDir = parentDescriptor.getParentFile();
|
||||
}
|
||||
MavenProject parent = assembleLineage( model, lineage, localRepository, parentProjectDir,
|
||||
|
||||
parentProject = assembleLineage( model, lineage, localRepository, parentProjectDir,
|
||||
parentSearchRepositories, aggregatedRemoteWagonRepositories,
|
||||
externalProfileManager, strict );
|
||||
parent.setFile( parentDescriptor );
|
||||
parentProject.setFile( parentDescriptor );
|
||||
|
||||
project.setParent( parent );
|
||||
project.setParent( parentProject );
|
||||
|
||||
project.setParentArtifact( parentArtifact );
|
||||
|
||||
}
|
||||
|
||||
return project;
|
||||
|
|
Loading…
Reference in New Issue