From 5d266e85ba757509471fbf91614b4d7b8a35f818 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Sun, 14 Sep 2008 05:11:21 +0000 Subject: [PATCH] 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 --- .../builder/PomClassicTransformer.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java b/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java index 007e72d5af..e028094b4c 100644 --- a/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java +++ b/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java @@ -542,6 +542,20 @@ public final class PomClassicTransformer return domainModel.getModel(); } + private static boolean containsProjectVersion( List 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 modelProperties, List interpolatorProperties, PomClassicDomainModel domainModel) @@ -551,6 +565,11 @@ public final class PomClassicTransformer Map aliases = new HashMap(); aliases.put( "project.", "pom."); + if(!containsProjectVersion(interpolatorProperties)) + { + aliases.put("\\$\\{project.version\\}", "\\$\\{version\\}"); + } + List firstPassModelProperties = new ArrayList(); List secondPassModelProperties = new ArrayList();