maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject [2/5] maven git commit: [MNG-4463] Dependency management import should support version ranges.
Date Wed, 08 Mar 2017 17:36:53 GMT
[MNG-4463] Dependency management import should support version ranges.

Closes #64 without merging. ITs are pending to be committed.


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

Branch: refs/heads/DEPMGMT-IMPORT
Commit: c0b0b8b384fc95f4c7e667f9b5d531c85836a4be
Parents: ab800b0
Author: Christian Schulte <schulte@apache.org>
Authored: Sat Jan 30 19:17:34 2016 +0100
Committer: Christian Schulte <schulte@apache.org>
Committed: Wed Mar 8 18:34:21 2017 +0100

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/c0b0b8b3/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 4ebb033..3699bd9 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
@@ -1213,7 +1213,25 @@ public class DefaultModelBuilder
                     final ModelSource importSource;
                     try
                     {
-                        importSource = modelResolver.resolveModel( groupId, artifactId, version
);
+                        dependency = dependency.clone();
+                        importSource = modelResolver.resolveModel( dependency );
+                        final String resolvedId =
+                            dependency.getGroupId() + ':' + dependency.getArtifactId() +
':' + dependency.getVersion();
+
+                        if ( !imported.equals( resolvedId ) && importIds.contains(
resolvedId ) )
+                        {
+                            // A version range has been resolved to a cycle.
+                            String message = "The dependencies of type=pom and with scope=import
form a cycle: ";
+                            for ( String modelId : importIds )
+                            {
+                                message += modelId + " -> ";
+                            }
+                            message += resolvedId;
+                            problems.add( new ModelProblemCollectorRequest( Severity.ERROR,
Version.BASE ).
+                                setMessage( message ) );
+
+                            continue;
+                        }
                     }
                     catch ( UnresolvableModelException e )
                     {


Mime
View raw message