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 ); + } + ]]> +