maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject [01/33] maven git commit: [MNG-6057] Problem with CI friendly usage of ${..} reactor order is changed o Based on the missing replacement of the versions ${revision} ${changelist} or ${sha1} within the parent element the order of the reactor change
Date Sat, 24 Sep 2016 15:19:23 GMT
Repository: maven
Updated Branches:
  refs/heads/MNG-6056-feature-toggle 4298b5187 -> 626a0406b


[MNG-6057] Problem with CI friendly usage of ${..} reactor order is
changed
 o Based on the missing replacement of the versions ${revision}
   ${changelist} or ${sha1} within the parent element the order
   of the reactor changes.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/dca6a2cc
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/dca6a2cc
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/dca6a2cc

Branch: refs/heads/MNG-6056-feature-toggle
Commit: dca6a2cceca575d05c1c4bcdfea9edf7ef83a17e
Parents: c2018a4
Author: Karl Heinz Marbaise <khmarbaise@apache.org>
Authored: Tue Sep 29 11:46:48 2015 +0200
Committer: Karl Heinz Marbaise <khmarbaise@apache.org>
Committed: Tue Jul 5 22:26:20 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 32 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/dca6a2cc/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 06ee1fa..6eccffa 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -74,6 +74,8 @@ import org.apache.maven.model.superpom.SuperPomProvider;
 import org.apache.maven.model.validation.ModelValidator;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.StringSearchInterpolator;
 
 import static org.apache.maven.model.building.Result.error;
 import static org.apache.maven.model.building.Result.newResult;
@@ -915,13 +917,37 @@ public class DefaultModelBuilder
         // save profile activations before interpolation, since they are evaluated with limited
scope
         Map<String, Activation> originalActivations = getProfileActivations( model,
true );
 
-        Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(),
request, problems );
-        result.setPomFile( model.getPomFile() );
+        Model interpolatedModel = modelInterpolator.interpolateModel( model, model.getProjectDirectory(),
request, problems );
+        if ( interpolatedModel.getParent() != null )
+        {
+            StringSearchInterpolator ssi = new StringSearchInterpolator();
+            ssi.addValueSource( new MapBasedValueSource( request.getUserProperties() ) );
+
+            ssi.addValueSource( new MapBasedValueSource( model.getProperties() ) );
+
+            ssi.addValueSource( new MapBasedValueSource( request.getSystemProperties() )
);
+
+            try
+            {
+                String interpolated = ssi.interpolate( interpolatedModel.getParent().getVersion()
);
+                interpolatedModel.getParent().setVersion( interpolated );
+            }
+            catch ( Exception e )
+            {
+                ModelProblemCollectorRequest mpcr = new ModelProblemCollectorRequest( Severity.ERROR,
Version.BASE )
+                    .setMessage(
+                                "Failed to interpolate field: " + interpolatedModel.getParent().getVersion()
+ " on class: "
+                                    ).setException(e );
+                problems.add( mpcr );
+            }
+
+        }
+        interpolatedModel.setPomFile( model.getPomFile() );
 
         // restore profiles with file activation to their value before full interpolation
         injectProfileActivations( model, originalActivations );
 
-        return result;
+        return interpolatedModel;
     }
 
     private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest
request,


Mime
View raw message