You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/03/30 13:54:35 UTC
svn commit: r390101 - in /maven/components/branches/maven-2.0.x:
integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/
maven-core-it/it0088/
maven-core-it/it0088/src/test/java/org/apache/maven/it0088/
maven-project/src/ma...
Author: brett
Date: Thu Mar 30 03:54:24 2006
New Revision: 390101
URL: http://svn.apache.org/viewcvs?rev=390101&view=rev
Log:
[MNG-2186] merge r390098 from trunk
Modified:
maven/components/branches/maven-2.0.x/integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
maven/components/branches/maven-2.0.x/maven-core-it/it0088/pom.xml
maven/components/branches/maven-2.0.x/maven-core-it/it0088/src/test/java/org/apache/maven/it0088/PomInterpolationTest.java
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/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java
Modified: maven/components/branches/maven-2.0.x/integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/branches/maven-2.0.x/integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java?rev=390101&r1=390100&r2=390101&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java (original)
+++ maven/components/branches/maven-2.0.x/integration-tests/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java Thu Mar 30 03:54:24 2006
@@ -26,6 +26,16 @@
*/
private String projectBuildDirectory;
+ /**
+ * @parameter expression="${targetDirectoryString}"
+ */
+ private String targetDirectoryString;
+
+ /**
+ * @parameter expression="${targetDirectoryFile}"
+ */
+ private File targetDirectoryFile;
+
public void execute()
throws MojoExecutionException
{
@@ -34,6 +44,14 @@
Properties mojoGeneratedPropeties = new Properties();
mojoGeneratedPropeties.put( "project.build.directory", projectBuildDirectory );
+ if ( targetDirectoryString != null )
+ {
+ mojoGeneratedPropeties.put( "targetDirectoryString", targetDirectoryString );
+ }
+ if ( targetDirectoryFile != null )
+ {
+ mojoGeneratedPropeties.put( "targetDirectoryFile", targetDirectoryFile.getAbsolutePath() );
+ }
FileOutputStream fos = new FileOutputStream( new File( basedir, "target/mojo-generated.properties" ) );
Modified: maven/components/branches/maven-2.0.x/maven-core-it/it0088/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/branches/maven-2.0.x/maven-core-it/it0088/pom.xml?rev=390101&r1=390100&r2=390101&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core-it/it0088/pom.xml (original)
+++ maven/components/branches/maven-2.0.x/maven-core-it/it0088/pom.xml Thu Mar 30 03:54:24 2006
@@ -29,6 +29,8 @@
<phase>process-resources</phase>
<configuration>
<projectBuildDirectory>${project.build.directory}</projectBuildDirectory>
+ <targetDirectoryString>target</targetDirectoryString>
+ <targetDirectoryFile>target</targetDirectoryFile>
</configuration>
<goals>
<goal>generate-properties</goal>
@@ -40,9 +42,9 @@
</build>
<pluginRepositories>
<pluginRepository>
- <id>snapshots</id>
- <name>Maven Central Plugins Development Repository</name>
- <url>http://snapshots.maven.codehaus.org/maven2</url>
+ <id>apache.snapshots</id>
+ <name>Maven Plugins Development Repository</name>
+ <url>http://cvs.apache.org/maven-snapshot-repository</url>
</pluginRepository>
</pluginRepositories>
</project>
Modified: maven/components/branches/maven-2.0.x/maven-core-it/it0088/src/test/java/org/apache/maven/it0088/PomInterpolationTest.java
URL: http://svn.apache.org/viewcvs/maven/components/branches/maven-2.0.x/maven-core-it/it0088/src/test/java/org/apache/maven/it0088/PomInterpolationTest.java?rev=390101&r1=390100&r2=390101&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core-it/it0088/src/test/java/org/apache/maven/it0088/PomInterpolationTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core-it/it0088/src/test/java/org/apache/maven/it0088/PomInterpolationTest.java Thu Mar 30 03:54:24 2006
@@ -30,10 +30,10 @@
File projectBuildDirectory = new File( basedir, "target" );
- assertEquals( testProperties.getProperty( "project.build.directory" ), projectBuildDirectory.getAbsolutePath() );
+ assertEquals( projectBuildDirectory.getAbsolutePath(), testProperties.getProperty( "project.build.directory" ) );
}
- public void testProjectBuildDirectoryAfterForMojoExecution()
+ public void testProjectBuildDirectoryForMojoExecution()
throws Exception
{
Properties testProperties = new Properties();
@@ -44,9 +44,10 @@
testProperties.load( new FileInputStream( testPropertiesFile ) );
- // [jdcasey] NOTE: This property is not a java.io.File, so it will NOT be adjusted
- // to the basedir! We need to simply check that it's value is "target", rather than
- // new java.io.File( basedir, "target" ).getAbsolutePath();
- assertEquals( testProperties.getProperty( "project.build.directory" ), "target" );
+ File projectBuildDirectory = new File( basedir, "target" );
+
+ assertEquals( projectBuildDirectory.getAbsolutePath(), testProperties.getProperty( "project.build.directory" ) );
+ assertEquals( projectBuildDirectory.getAbsolutePath(), testProperties.getProperty( "targetDirectoryFile" ) );
+ assertEquals( "target", testProperties.getProperty( "targetDirectoryString" ) );
}
}
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=390101&r1=390100&r2=390101&view=diff
==============================================================================
--- 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 Thu Mar 30 03:54:24 2006
@@ -687,20 +687,17 @@
// we don't have to force the collision exception for superModel here, it's already been done in getSuperModel()
MavenProject previousProject = superProject;
-
+
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;
-
+
try
{
pathAdjustment = previousProject.getModulePathAdjustment( currentProject );
@@ -714,8 +711,6 @@
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
@@ -841,6 +836,16 @@
context.put( "basedir", projectDir.getAbsolutePath() );
}
+ // TODO: this is a hack to ensure MNG-2124 can be satisfied without triggering MNG-1927
+ // MNG-1927 relies on the false assumption that ${project.build.*} evaluates to null, which occurs before
+ // MNG-2124 is fixed. The null value would leave it uninterpolated, to be handled after path translation.
+ // Until these steps are correctly sequenced, we guarantee these fields remain uninterpolated.
+ context.put( "build.directory", null );
+ context.put( "build.outputDirectory", null );
+ context.put( "build.testOutputDirectory", null );
+ context.put( "build.sourceDirectory", null );
+ context.put( "build.testSourceDirectory", null );
+
model = modelInterpolator.interpolate( model, context, strict );
// interpolation is before injection, because interpolation is off-limits in the injected variables
@@ -1005,18 +1010,18 @@
// the only way this will have a value is if we find the parent on disk...
File parentDescriptor = 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
@@ -1024,7 +1029,7 @@
if ( model == null && projectDir != null && StringUtils.isNotEmpty( parentRelativePath ) )
{
parentDescriptor = new File( projectDir, parentRelativePath );
-
+
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Searching for parent-POM: " + parentModel.getId() + " of project: " + project.getId() + " in relative path: " + parentRelativePath );
@@ -1046,7 +1051,7 @@
{
getLogger().debug( "Parent-POM: " + parentModel.getId() + " for project: " + project.getId() + " cannot be loaded from relative path: " + parentDescriptor + "; path does not exist." );
}
-
+
parentDescriptor = null;
}
}
@@ -1118,14 +1123,14 @@
// we can't query the parent to ask where it is :)
List remoteRepositories = new ArrayList( aggregatedRemoteWagonRepositories );
remoteRepositories.addAll( parentSearchRepositories );
-
+
if ( getLogger().isDebugEnabled() )
{
getLogger().debug(
"Retrieving parent-POM: " + parentModel.getId() + " for project: "
+ project.getId() + " from the repository." );
}
-
+
parentArtifact = artifactFactory.createParentArtifact( parentModel.getGroupId(),
parentModel.getArtifactId(),
parentModel.getVersion() );
@@ -1151,7 +1156,7 @@
{
parentProjectDir = parentDescriptor.getParentFile();
}
-
+
parentProject = assembleLineage( model, lineage, localRepository, parentProjectDir,
parentSearchRepositories, aggregatedRemoteWagonRepositories,
externalProfileManager, strict );
@@ -1160,7 +1165,7 @@
project.setParent( parentProject );
project.setParentArtifact( parentArtifact );
-
+
}
return project;
Modified: maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java
URL: http://svn.apache.org/viewcvs/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java?rev=390101&r1=390100&r2=390101&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java Thu Mar 30 03:54:24 2006
@@ -129,6 +129,13 @@
if ( value == null )
{
+ // This may look out of place, but its here for the MNG-2124/MNG-1927 fix described in the project builder
+ if ( context.containsKey( realExpr ) )
+ {
+ // It existed, but was null. Leave it alone.
+ continue;
+ }
+
value = model.getProperties().getProperty( realExpr );
}
@@ -137,7 +144,7 @@
try
{
// NOTE: We've already trimmed off any leading expression parts like 'project.'
- // or 'pom.', and now we have to ensure that the ReflectionValueExtractor
+ // or 'pom.', and now we have to ensure that the ReflectionValueExtractor
// doesn't try to do it again.
value = ReflectionValueExtractor.evaluate( realExpr, model, false );
}