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/29 02:32:47 UTC
svn commit: r690059 -
/maven/components/branches/sisbell-maven-2.1-profile/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java
Author: sisbell
Date: Thu Aug 28 17:32:47 2008
New Revision: 690059
URL: http://svn.apache.org/viewvc?rev=690059&view=rev
Log:
It's still possible that the exclusions properties (dependency/exclusions) will be sorted first when joining a container. This fix explicitly finds the base URI so that the ids (artifactId, groupId) will always be correct, regardless of order.
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=690059&r1=690058&r2=690059&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 Thu Aug 28 17:32:47 2008
@@ -73,22 +73,36 @@
private List<ModelProperty> properties;
+ private static String findBaseUriFrom(List<ModelProperty> modelProperties)
+ {
+ String baseUri = null;
+ for(ModelProperty mp : modelProperties)
+ {
+ if(baseUri == null || mp.getUri().length() < baseUri.length())
+ {
+ baseUri = mp.getUri();
+ }
+ }
+ return baseUri;
+ }
+
private ArtifactModelContainer( List<ModelProperty> properties )
{
this.properties = new ArrayList<ModelProperty>( properties );
this.properties = Collections.unmodifiableList( this.properties );
+ String uri = findBaseUriFrom( this.properties );
for ( ModelProperty mp : properties )
{
- if ( mp.getUri().endsWith( "version" ) && version == null)
+ if ( version == null && mp.getUri().equals( uri + "/version" ) )
{
this.version = mp.getValue();
}
- else if ( mp.getUri().endsWith( "artifactId" ) && artifactId == null)
+ else if ( artifactId == null && mp.getUri().equals( uri + "/artifactId" ) )
{
this.artifactId = mp.getValue();
}
- else if ( mp.getUri().endsWith( "groupId" ) && groupId == null)
+ else if ( groupId == null && mp.getUri().equals( uri + "/groupId" ) )
{
this.groupId = mp.getValue();
}