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();