o Fixed interpolation of system properties and env vars

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@755754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-18 22:13:23 +00:00
parent 1f9687628c
commit f52da7a874
3 changed files with 10 additions and 8 deletions

View File

@ -459,7 +459,6 @@ public class DefaultMavenProjectBuilder
return buildModel( pom, interpolatorProperties, null, null, localRepository, remoteRepositories );
}
@SuppressWarnings("unchecked")
private PomClassicDomainModel buildModel( File pom, Collection<InterpolatorProperty> interpolatorProperties, Collection<String> activeProfileIds, Collection<String> inactiveProfileIds,
ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws IOException
@ -541,7 +540,7 @@ public class DefaultMavenProjectBuilder
}
}
PomClassicDomainModel transformedDomainModel = ProcessorContext.build( profileModels );
PomClassicDomainModel transformedDomainModel = ProcessorContext.build( profileModels, properties );
// Lineage count is inclusive to add the POM read in itself.
transformedDomainModel.setLineageCount( lineageCount + 1 );
transformedDomainModel.setParentFile( parentFile );

View File

@ -134,7 +134,8 @@ public class ProcessorContext
* @return
* @throws IOException
*/
public static PomClassicDomainModel build( List<DomainModel> domainModels )
public static PomClassicDomainModel build( List<DomainModel> domainModels,
List<InterpolatorProperty> interpolationProperties )
throws IOException
{
PomClassicDomainModel child = null;
@ -159,7 +160,7 @@ public class ProcessorContext
Model target = processModelsForInheritance(convertDomainModelsToMavenModels(domainModels), processors, true);
PomClassicDomainModel model = convertToDomainModel( target, false );
interpolateModelProperties( model.getModelProperties(), new ArrayList<InterpolatorProperty>(), child );
interpolateModelProperties( model.getModelProperties(), interpolationProperties, child );
List<ModelProperty> modelProperties;
if ( child.getProjectDirectory() != null )
{

View File

@ -19,6 +19,7 @@ import org.apache.maven.project.builder.PomClassicDomainModel;
import org.apache.maven.project.harness.PomTestWrapper;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.InterpolatorProperty;
import org.codehaus.plexus.PlexusTestCase;
public class ProcessorContextTest extends PlexusTestCase
@ -57,7 +58,7 @@ public class ProcessorContextTest extends PlexusTestCase
DomainModel pdmParent = new PomClassicDomainModel(parent);
DomainModel pdmChild = new PomClassicDomainModel(child, true);
ProcessorContext.build( Arrays.asList(pdmChild, pdmParent));
ProcessorContext.build( Arrays.asList( pdmChild, pdmParent ), new ArrayList<InterpolatorProperty>() );
assertEquals("pom", child.getPackaging());
}
@ -89,7 +90,8 @@ public class ProcessorContextTest extends PlexusTestCase
DomainModel child = new PomClassicDomainModel(new Model(), true);
PomClassicDomainModel m = ProcessorContext.build( Arrays.asList(child, pdm)) ;
PomClassicDomainModel m =
ProcessorContext.build( Arrays.asList( child, pdm ), new ArrayList<InterpolatorProperty>() );
assertEquals(1, m.getModel().getBuild().getPluginManagement().getPlugins().size());
}
@ -151,8 +153,8 @@ public class ProcessorContextTest extends PlexusTestCase
}
}
ProcessorContext.build( domainModels );
ProcessorContext.build( domainModels, new ArrayList<InterpolatorProperty>() );
return new PomTestWrapper( ProcessorContext.build( domainModels ) );
return new PomTestWrapper( ProcessorContext.build( domainModels, new ArrayList<InterpolatorProperty>() ) );
}
}