You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2008/08/27 20:40:21 UTC

svn commit: r689554 - /maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java

Author: sisbell
Date: Wed Aug 27 11:40:21 2008
New Revision: 689554

URL: http://svn.apache.org/viewvc?rev=689554&view=rev
Log:
If pom contained dependency exclusion http://apache.org/maven/project/dependencies#collection/dependency/exclusions/exclusion/artifactId, the artifact model container would override the http://apache.org/maven/project/dependencies#collection/dependency/artifactId, resulting in pulling wrong dependencies.

Modified:
    maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java

Modified: maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java?rev=689554&r1=689553&r2=689554&view=diff
==============================================================================
--- maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java (original)
+++ maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java Wed Aug 27 11:40:21 2008
@@ -80,19 +80,19 @@
 
             for ( ModelProperty mp : properties )
             {
-                if ( mp.getUri().endsWith( "version" ) )
+                if ( mp.getUri().endsWith( "version" ) && version == null)
                 {
                     this.version = mp.getValue();
                 }
-                else if ( mp.getUri().endsWith( "artifactId" ) )
+                else if ( mp.getUri().endsWith( "artifactId" ) && artifactId == null)
                 {
                     this.artifactId = mp.getValue();
                 }
-                else if ( mp.getUri().endsWith( "groupId" ) )
+                else if ( mp.getUri().endsWith( "groupId" ) && groupId == null)
                 {
                     this.groupId = mp.getValue();
                 }
-                else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) )
+                else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) && type == null)
                 {
                     this.type = mp.getValue();
                 }
@@ -106,8 +106,12 @@
 
             if ( artifactId == null )
             {
+                StringBuffer sb = new StringBuffer();
+                for(ModelProperty mp: properties) {
+                    sb.append(mp).append("\r\n");
+                }
                 throw new IllegalArgumentException(
-                    "Properties does not contain artifact id. Group ID = " + groupId + ", Version = " + version );
+                    "Properties does not contain artifact id. Group ID = " + groupId + ", Version = " + version + ":" + sb);
             }
 
             if ( type == null )