You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2006/08/21 22:21:42 UTC
svn commit: r433346 - in /maven/maven-1/core/trunk/src:
java/org/apache/maven/project/Project.java
test/java/org/apache/maven/project/LegacyIdTest.java
test/test-data/pom/test-id-and-groupId-and-artifactId.xml
Author: ltheussl
Date: Mon Aug 21 13:21:41 2006
New Revision: 433346
URL: http://svn.apache.org/viewvc?rev=433346&view=rev
Log:
PR: MAVEN-1767
id is used instead of artifactId
Added:
maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml (with props)
Modified:
maven/maven-1/core/trunk/src/java/org/apache/maven/project/Project.java
maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java
Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/project/Project.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/java/org/apache/maven/project/Project.java?rev=433346&r1=433345&r2=433346&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/project/Project.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/project/Project.java Mon Aug 21 13:21:41 2006
@@ -1396,18 +1396,43 @@
originalGroupId = model.getGroupId();
if ( model.getId() != null )
{
- if ( model.getGroupId() == null )
+ if ( model.getGroupId() == null && model.getArtifactId() == null)
{
setId( model.getId() );
}
else
{
- model.setArtifactId( model.getId() );
+ String id = model.getId();
+ if ( model.getGroupId() == null )
+ {
+ int j = id.indexOf( ":" );
+ if ( j > 0 )
+ {
+ setGroupId( id.substring( 0, j ) );
+ }
+ else
+ {
+ setGroupId( id );
+ }
+ }
+ if ( model.getArtifactId() == null )
+ {
+ int j = id.indexOf( ":" );
+ if ( j > 0 )
+ {
+ setArtifactId( id.substring( j + 1 ) );
+ }
+ else
+ {
+ setArtifactId( id );
+ }
+ }
}
}
else if ( model.getGroupId() == null )
{
model.setGroupId( model.getArtifactId() );
+ log.debug("No groupId found, setting to: " + model.getArtifactId() );
}
}
@@ -1460,6 +1485,7 @@
else if ( dependency.getGroupId() == null )
{
dependency.setGroupId( dependency.getArtifactId() );
+ log.debug("Dependency has no groupId, setting to: " + dependency.getArtifactId() );
}
dependency.setId( dependency.getGroupId() + ":" + dependency.getArtifactId() );
dependencyMap.put( dependency.getKey(), dependency );
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java?rev=433346&r1=433345&r2=433346&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java Mon Aug 21 13:21:41 2006
@@ -144,6 +144,18 @@
assertEquals( "check id", "groupId:artifactId", p.getId() );
}
+ public void testIdAndGroupIdAndArtifactId()
+ throws Exception
+ {
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml" ) );
+ assertEquals( "check id", "groupId:artifactId", p.getId() );
+ assertEquals( "check artifact id", "artifactId", p.getArtifactId() );
+ assertEquals( "check group id", "groupId", p.getGroupId() );
+ assertEquals( "check id", "groupId:artifactId", p.getId() );
+ }
+
public void testExtendNone()
throws Exception
{
Added: maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml?rev=433346&view=auto
==============================================================================
--- maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml (added)
+++ maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml Mon Aug 21 13:21:41 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<project>
+ <id>id</id>
+ <artifactId>artifactId</artifactId>
+ <groupId>groupId</groupId>
+ <name>Test Project</name>
+</project>
Propchange: maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: maven/maven-1/core/trunk/src/test/test-data/pom/test-id-and-groupId-and-artifactId.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"