This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-6846
in repository https://gitbox.apache.org/repos/asf/maven.git

commit ec8c65a2e6005f79049619056f9b4c68a48db44f
Author: zhaoyunxing92 <[email protected]>
AuthorDate: Fri Jan 10 20:54:21 2020 +0800

    [MNG-6846] conditional overwrite version
---
 .../model/interpolation/AbstractStringBasedModelInterpolator.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
 
b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
index 388671d..c6f5755 100644
--- 
a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
+++ 
b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
@@ -163,15 +163,16 @@ public abstract class AbstractStringBasedModelInterpolator
 
         // Overwrite existing values in model properties. Otherwise it's not 
possible
         // to define the version via command line: mvn -Drevision=6.5.7 ...
-        if ( config.getSystemProperties().containsKey( REVISION_PROPERTY ) )
+        // I think this overwrite is conditional and only overwrite current 
projects
+        if ( config.getSystemProperties().containsKey( REVISION_PROPERTY ) && 
projectDir!=null )
         {
             modelProperties.put( REVISION_PROPERTY, 
config.getSystemProperties().get( REVISION_PROPERTY ) );
         }
-        if ( config.getSystemProperties().containsKey( CHANGELIST_PROPERTY ) )
+        if ( config.getSystemProperties().containsKey( CHANGELIST_PROPERTY ) 
&& projectDir!=null )
         {
             modelProperties.put( CHANGELIST_PROPERTY, 
config.getSystemProperties().get( CHANGELIST_PROPERTY ) );
         }
-        if ( config.getSystemProperties().containsKey( SHA1_PROPERTY ) )
+        if ( config.getSystemProperties().containsKey( SHA1_PROPERTY ) && 
projectDir!=null )
         {
             modelProperties.put( SHA1_PROPERTY, 
config.getSystemProperties().get( SHA1_PROPERTY ) );
         }

Reply via email to