Fixed handling of <id>ant+optional</id> in pom-level info as well as dependencies.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@168631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-05-06 17:41:40 +00:00
parent 76c4ceda28
commit 6dbf18fceb
1 changed files with 25 additions and 6 deletions

View File

@ -65,21 +65,31 @@ public class PomV3ToV4Translator extends AbstractLogEnabled
String groupId = format( v3Model.getGroupId() ); String groupId = format( v3Model.getGroupId() );
String artifactId = format( v3Model.getArtifactId() ); String artifactId = format( v3Model.getArtifactId() );
String id = format( v3Model.getId() ); String id = v3Model.getId();
if ( StringUtils.isNotEmpty( id ) ) if ( StringUtils.isNotEmpty( id ) )
{ {
if ( StringUtils.isEmpty( groupId ) ) if ( StringUtils.isEmpty( groupId ) )
{
int plusIdx = id.indexOf("+");
if(plusIdx > -1)
{
groupId = id.substring(0, plusIdx);
}
else
{ {
groupId = id; groupId = id;
} }
}
if ( StringUtils.isEmpty( artifactId ) ) if ( StringUtils.isEmpty( artifactId ) )
{ {
artifactId = id; artifactId = format( id );
} }
} }
String version = format( v3Model.getCurrentVersion() ); String version = format( v3Model.getCurrentVersion() );
if ( version == null ) if ( version == null )
{ {
version = format( v3Model.getVersion() ); version = format( v3Model.getVersion() );
@ -503,18 +513,27 @@ public class PomV3ToV4Translator extends AbstractLogEnabled
String groupId = format( v3Dep.getGroupId() ); String groupId = format( v3Dep.getGroupId() );
String artifactId = format( v3Dep.getArtifactId() ); String artifactId = format( v3Dep.getArtifactId() );
String id = format( v3Dep.getId() ); String id = v3Dep.getId();
if ( StringUtils.isNotEmpty( id ) ) if ( StringUtils.isNotEmpty( id ) )
{ {
if ( StringUtils.isEmpty( groupId ) ) if ( StringUtils.isEmpty( groupId ) )
{
int plusIdx = id.indexOf("+");
if(plusIdx > -1)
{
groupId = id.substring(0, plusIdx);
}
else
{ {
groupId = id; groupId = id;
} }
}
if ( StringUtils.isEmpty( artifactId ) ) if ( StringUtils.isEmpty( artifactId ) )
{ {
artifactId = id; artifactId = format( id );
} }
} }