Repository: maven
Updated Branches:
  refs/heads/master 7ef71655b -> 25f514316


[MNG-5840] The fix for parent version validation caused a regression in the 
parent version range

- With this change we basically unwind MNG-5840 for the rumoured validation in 
the workspace resolver
  when dealing with a parent version range. Not ideal but only way for now to 
retain the version range feature


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

Branch: refs/heads/master
Commit: 25f5143169d39075cee67d9f4d11649cce0fafa0
Parents: 7ef7165
Author: Stephen Connolly <stephen.alan.conno...@gmail.com>
Authored: Wed Jul 22 08:38:05 2015 +0100
Committer: Stephen Connolly <stephen.alan.conno...@gmail.com>
Committed: Wed Jul 22 08:38:05 2015 +0100

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 25 +++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/25f51431/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 2be2132..f8f4dab 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
@@ -513,7 +513,7 @@ public class DefaultModelBuilder
             }
         }
 
-        problems.setSource( modelSource.getLocation() );
+        problems.setSource(modelSource.getLocation());
         try
         {
             boolean strict = request.getValidationLevel() >= 
ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
@@ -594,10 +594,10 @@ public class DefaultModelBuilder
             throw problems.newModelBuildingException();
         }
 
-        model.setPomFile( pomFile );
+        model.setPomFile(pomFile);
 
-        problems.setSource( model );
-        modelValidator.validateRawModel( model, request, problems );
+        problems.setSource(model);
+        modelValidator.validateRawModel(model, request, problems);
 
         if ( hasFatalErrors( problems ) )
         {
@@ -615,7 +615,7 @@ public class DefaultModelBuilder
         context.setInactiveProfileIds( request.getInactiveProfileIds() );
         context.setSystemProperties( request.getSystemProperties() );
         context.setUserProperties( request.getUserProperties() );
-        context.setProjectDirectory( ( request.getPomFile() != null ) ? 
request.getPomFile().getParentFile() : null );
+        context.setProjectDirectory((request.getPomFile() != null) ? 
request.getPomFile().getParentFile() : null);
 
         return context;
     }
@@ -735,7 +735,7 @@ public class DefaultModelBuilder
                 activation = activation.clone();
             }
 
-            activations.put( profile.getId(), activation );
+            activations.put(profile.getId(), activation);
         }
 
         return activations;
@@ -921,8 +921,17 @@ public class DefaultModelBuilder
         }
         if ( version != null && parent.getVersion() != null && 
!version.equals( parent.getVersion() ) )
         {
-            // version skew drop back to resolution from the repository
-            return null;
+            //
+            // If the parent version is a range we will let it through here as 
we do not have the classes
+            // for determining if the parent is within the range in scope. 
This may lead to MNG-5840 style
+            // regressions in the range, but without this the parent version 
range will not work at all.
+            //
+            
+            if ( !parent.getVersion().startsWith("[") && 
!parent.getVersion().startsWith("(") ) 
+            {
+                // version skew drop back to resolution from the repository
+                return null;
+            }
         }
 
         //

Reply via email to