[MDEP-379] use the normal artifactId-version-classifier scheme instead of actual artifactId-classifier-version-type
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1481559 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java b/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
index a67e81b..db93a26 100644
--- a/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
+++ b/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
@@ -206,30 +206,27 @@
sb.append( artifact.getArtifactId() );
+ if ( !removeVersion )
+ {
+ sb.append( "-" );
+ sb.append( artifact.getVersion() );
+ }
+
if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
{
sb.append( "-" );
sb.append( artifact.getClassifier() );
}
- if ( !removeVersion )
+ // if the classifier and type are the same (sources), then don't
+ // repeat.
+ // avoids names like foo-sources-sources
+ if ( !StringUtils.equals( artifact.getClassifier(), artifact.getType() ) )
{
sb.append( "-" );
- sb.append( artifact.getVersion() );
- sb.append( "-" );
sb.append( artifact.getType() );
}
- else
- {
- // if the classifier and type are the same (sources), then don't
- // repeat.
- // avoids names like foo-sources-sources
- if ( !StringUtils.equals( artifact.getClassifier(), artifact.getType() ) )
- {
- sb.append( "-" );
- sb.append( artifact.getType() );
- }
- }
+
return sb.toString();
}
diff --git a/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java b/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java
index 45ba723..c24019f 100644
--- a/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java
+++ b/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java
@@ -118,7 +118,7 @@
assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, false, folder, artifact );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "one-sources-1.1-jar";
+ expectedResult = folder.getAbsolutePath() + File.separatorChar + "one-1.1-sources-jar";
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, true, folder, artifact );
@@ -127,7 +127,7 @@
name = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, false, folder, artifact );
expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar
- + "one-sources-1.1-jar";
+ + "one-1.1-sources-jar";
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, true, folder, artifact );
@@ -186,7 +186,7 @@
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, false, folder, sources );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-sources-1.1-SNAPSHOT-sources";
+ expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-1.1-SNAPSHOT-sources";
assertEquals( expectedResult, name.getAbsolutePath() );
}