Fix: MNG2339b - If \$\{version} is not specified as a system or environment variable, then it is aliased as \$\{project.version} so that it will be interpolated.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@695114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-09-14 05:11:21 +00:00
parent 38b9c5c25b
commit 5d266e85ba
1 changed files with 19 additions and 0 deletions

View File

@ -542,6 +542,20 @@ public final class PomClassicTransformer
return domainModel.getModel();
}
private static boolean containsProjectVersion( List<InterpolatorProperty> interpolatorProperties )
{
InterpolatorProperty versionInterpolatorProperty =
new ModelProperty( ProjectUri.version, "").asInterpolatorProperty( ProjectUri.baseUri);
for( InterpolatorProperty ip : interpolatorProperties)
{
if ( ip.equals( versionInterpolatorProperty ) )
{
return true;
}
}
return false;
}
private static void interpolateModelProperties(List<ModelProperty> modelProperties,
List<InterpolatorProperty> interpolatorProperties,
PomClassicDomainModel domainModel)
@ -551,6 +565,11 @@ public final class PomClassicTransformer
Map<String, String> aliases = new HashMap<String, String>();
aliases.put( "project.", "pom.");
if(!containsProjectVersion(interpolatorProperties))
{
aliases.put("\\$\\{project.version\\}", "\\$\\{version\\}");
}
List<ModelProperty> firstPassModelProperties = new ArrayList<ModelProperty>();
List<ModelProperty> secondPassModelProperties = new ArrayList<ModelProperty>();