maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject git commit: MNG-5576 Start allowing continuous delivery friendy versions
Date Fri, 07 Feb 2014 02:55:39 GMT
Updated Branches:
  refs/heads/master 097cc8d25 -> 88d0abcd3


MNG-5576 Start allowing continuous delivery friendy versions


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

Branch: refs/heads/master
Commit: 88d0abcd30a0ab040850b3086b3f0ddd8e9607f3
Parents: 097cc8d
Author: Jason van Zyl <jason@tesla.io>
Authored: Thu Feb 6 21:55:10 2014 -0500
Committer: Jason van Zyl <jason@tesla.io>
Committed: Thu Feb 6 21:55:10 2014 -0500

----------------------------------------------------------------------
 .../model/validation/DefaultModelValidator.java | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/88d0abcd/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index 54597d9..7fd4d86 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -106,7 +106,7 @@ public class DefaultModelValidator
             validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20,
model.getArtifactId(), model );
             validateStringNotEmpty( "artifactId", problems, Severity.FATAL, Version.V20,
model.getArtifactId(), model );
 
-            validateStringNoExpression( "version", problems, Severity.WARNING, Version.V20,
model.getVersion(), model );
+            validateVersionNoExpression( "version", problems, Severity.WARNING, Version.V20,
model.getVersion(), model );
             if ( parent == null )
             {
                 validateStringNotEmpty( "version", problems, Severity.FATAL, Version.V20,
model.getVersion(), model );
@@ -681,6 +681,32 @@ public class DefaultModelValidator
         return false;
     }
 
+    private boolean validateVersionNoExpression(String fieldName, ModelProblemCollector problems,
Severity severity, Version version, 
+                                                String string, InputLocationTracker tracker)

+    {
+      
+      if ( !hasExpression( string ) ) 
+      {
+          return true;
+      }
+  
+      //
+      // Acceptable versions for continuous delivery
+      //
+      // changelist
+      // revision
+      // sha1
+      //
+      if( string.trim().contains("${changelist}") || string.trim().contains("${revision}")
|| string.trim().contains("${sha1}") ) 
+      {
+          return true;  
+      }
+      
+      addViolation(problems, severity, version, fieldName, null, "contains an expression
but should be a constant.", tracker);
+  
+      return false;
+    }    
+    
     private boolean hasExpression( String value )
     {
         return value != null && value.contains( "${" );


Mime
View raw message