[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; return false;
} }
private static void putProjectAliasIn(Map<String, String> map, String s) private static final Map<String, String> aliases = new HashMap<String, String>();
{
map.put( "\\$\\{project." + s + "\\}", "\\$\\{" + s + "\\}");
}
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 static
{ {
aliases.put( "project.", "pom."); aliases.put( "\\$\\{project\\.", "\\$\\{pom\\.");
aliases.put( "\\$\\{project.build.", "\\$\\{build."); addProjectAlias( "modelVersion", true );
addProjectAlias( "groupId", true );
List<String> aliasList = Arrays.asList("artifactId", "groupId", "version", "packaging", "name", "description", addProjectAlias( "artifactId", true );
"url", "inceptionYear", "scm.url", "ciManagement.url", addProjectAlias( "version", true );
"distributionManagement.repository.name", addProjectAlias( "packaging", true );
"distributionManagement.site.url", addProjectAlias( "name", true );
"reporting.outputDirectory", "parent.groupId", "parent.artifactId", addProjectAlias( "description", true );
"parent.version", "prerequisites.maven", "issueManagement.url", "organization.name"); addProjectAlias( "inceptionYear", true );
for(String alias : aliasList) { addProjectAlias( "url", true );
putProjectAliasIn(aliases, alias); 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, private static void interpolateModelProperties(List<ModelProperty> modelProperties,