[MNG-3831] Expressions without project/pom prefix are no longer interpolated with model values

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@713052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-11-11 14:44:19 +00:00
parent 30f86cb7c8
commit 07fb543422
1 changed files with 25 additions and 18 deletions

View File

@ -590,28 +590,35 @@ public final class PomClassicTransformer
return false;
}
private static void putProjectAliasIn(Map<String, String> map, String s)
{
map.put( "\\$\\{project." + s + "\\}", "\\$\\{" + s + "\\}");
}
private static final Map<String, String> aliases = new HashMap<String, String>();
private static Map<String, String> aliases = new HashMap<String, String>();
private static void addProjectAlias( String element, boolean leaf )
{
String suffix = leaf ? "\\}" : "\\.";
aliases.put( "\\$\\{project\\." + element + suffix, "\\$\\{" + element + suffix );
}
static
{
aliases.put( "project.", "pom.");
aliases.put( "\\$\\{project.build.", "\\$\\{build.");
List<String> aliasList = Arrays.asList("artifactId", "groupId", "version", "packaging", "name", "description",
"url", "inceptionYear", "scm.url", "ciManagement.url",
"distributionManagement.repository.name",
"distributionManagement.site.url",
"reporting.outputDirectory", "parent.groupId", "parent.artifactId",
"parent.version", "prerequisites.maven", "issueManagement.url", "organization.name");
for(String alias : aliasList) {
putProjectAliasIn(aliases, alias);
}
aliases.put( "\\$\\{project\\.", "\\$\\{pom\\.");
addProjectAlias( "modelVersion", true );
addProjectAlias( "groupId", true );
addProjectAlias( "artifactId", true );
addProjectAlias( "version", true );
addProjectAlias( "packaging", true );
addProjectAlias( "name", true );
addProjectAlias( "description", true );
addProjectAlias( "inceptionYear", true );
addProjectAlias( "url", true );
addProjectAlias( "parent", false );
addProjectAlias( "prerequisites", false );
addProjectAlias( "organization", false );
addProjectAlias( "build", false );
addProjectAlias( "reporting", false );
addProjectAlias( "scm", false );
addProjectAlias( "distributionManagement", false );
addProjectAlias( "issueManagement", false );
addProjectAlias( "ciManagement", false );
}
private static void interpolateModelProperties(List<ModelProperty> modelProperties,