From 2fbbfa6274756ac05fb44644061f440634b0f5de Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Sun, 19 Sep 2004 01:30:53 +0000 Subject: [PATCH] add some legacy dependency stuff for v3.0.0 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163115 13f79535-47bb-0310-9956-ffa450edef68 --- maven-model/maven.mdo | 122 ++++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/maven-model/maven.mdo b/maven-model/maven.mdo index 51ba218ce9..f16a736958 100644 --- a/maven-model/maven.mdo +++ b/maven-model/maven.mdo @@ -57,6 +57,15 @@ true String + + id + 3.0.0 + true + + The id of the dependency. + + String + groupId 3.0.0+ @@ -419,32 +428,6 @@ } - - 3.0.0 - - public void setId( String id ) - { - int i = id.indexOf( "+" ); - int j = id.indexOf( ":" ); - - if ( i > 0 ) - { - setGroupId( id.substring( 0, i ) ); - setArtifactId( id.replace( '+', '-' ) ); - } - else if ( j > 0 ) - { - setGroupId( id.substring( 0, j ) ); - setArtifactId( id.substring( j + 1 ) ); - } - else - { - setGroupId( id ); - setArtifactId( id ); - } - } - - @@ -706,15 +689,6 @@ Dependency 3.0.0+ - - id - 3.0.0 - true - - The id of the dependency. - - String - groupId 3.0.0+ @@ -808,6 +782,84 @@ } + + 3.0.0 + 0 ) + { + // We have something like 'ant+optional' where the + // group id is 'ant' and the artifact id is + // 'ant-optional'. + setGroupId( id.substring( 0, i ) ); + setArtifactId( id.replace( '+', '-' ) ); + } + else if ( j > 0 ) + { + // We have something like 'ant:my-poorly-name.jar' where the + // group id is 'ant' and the artifact id is + // 'my-poorly-named.jar'. + setGroupId( id.substring( 0, j ) ); + setArtifactId( id.substring( j + 1 ) ); + } + else + { + // We have something like 'ant' where the + // the project id is 'ant' and the artifact name + // is 'ant'. + setGroupId( id ); + setArtifactId( id ); + } + } + + public String getId() + { + return getGroupId() + ":" + getArtifactId(); + } + + public String getArtifactDirectory() + { + return getGroupId(); + } + + public String getArtifact() + { + // If the jar name has been explicty set then use that. This + // is when the element is explicity used in the POM. + if ( getJar() != null) + { + return getJar(); + } + + return getArtifactId() + "-" + getVersion() + "." + getExtension(); + } + + public String getExtension() + { + if ("ejb".equals(getType()) || "plugin".equals(getType()) || "aspect".equals(getType())) return "jar"; + return getType(); + } + + public boolean isAddedToClasspath() + { + return ("jar".equals(getType()) || "ejb".equals(getType())); + } + + public boolean isPlugin() + { + return ("plugin".equals(getType())); + } + + public String getProperty( String property ) + { + return getProperties().getProperty( property ); + } + ]]> +