Revert "MNG-5552 made classifier part of MavenProject.artifactMap key"

This reverts commit f35698c790.

There are plugins that rely on the broken behaviour and I don't have the
time to fix this in backwards compatible way right now.

http://markmail.org/message/gjfuofw5gpsr5yxz

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2014-02-13 21:36:03 -05:00
parent 30fadd074e
commit 0f1fcd7066
2 changed files with 2 additions and 51 deletions

View File

@ -68,15 +68,10 @@ public final class ArtifactUtils
public static String versionlessKey( Artifact artifact ) public static String versionlessKey( Artifact artifact )
{ {
return versionlessKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier() ); return versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );
} }
public static String versionlessKey( String groupId, String artifactId ) public static String versionlessKey( String groupId, String artifactId )
{
return versionlessKey( groupId, artifactId, null );
}
public static String versionlessKey( String groupId, String artifactId, String classifier )
{ {
if ( groupId == null ) if ( groupId == null )
{ {
@ -86,13 +81,7 @@ public final class ArtifactUtils
{ {
throw new NullPointerException( "artifactId is null" ); throw new NullPointerException( "artifactId is null" );
} }
StringBuilder key = new StringBuilder(); return groupId + ":" + artifactId;
key.append( groupId ).append( ':' ).append( artifactId );
if ( classifier != null && !"".equals( classifier.trim() ) )
{
key.append( ':' ).append( classifier );
}
return key.toString();
} }
public static String key( Artifact artifact ) public static String key( Artifact artifact )

View File

@ -22,11 +22,9 @@ package org.apache.maven.plugin;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set;
import org.apache.maven.AbstractCoreMavenComponentTestCase; import org.apache.maven.AbstractCoreMavenComponentTestCase;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
@ -382,28 +380,6 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "testGroup", result.getGroupId() ); assertEquals( "testGroup", result.getGroupId() );
} }
public void testProjectArtifactMap()
throws Exception
{
Model model = new Model();
MavenProject project = new MavenProject( model );
Set<Artifact> artifacts = new HashSet<Artifact>();
artifacts.add( createArtifact( "testGroup", "testArtifact", "1.0" ) );
artifacts.add( createArtifact( "testGroup", "testArtifact", "1.0", "testClassifier" ) );
project.setArtifacts( artifacts );
ExpressionEvaluator ee = createExpressionEvaluator( project, null, new Properties() );
@SuppressWarnings( "unchecked" )
Map<String, Artifact> depResults = (Map<String, Artifact>) ee.evaluate( "${project.artifactMap}" );
assertEquals( 2, depResults.size() );
assertNotNull( depResults.get( "testGroup:testArtifact" ) );
assertNotNull( depResults.get( "testGroup:testArtifact:testClassifier" ) );
assertNull( ( (Artifact) ee.evaluate( "${project.artifactMap(testGroup:testArtifact)}" ) ).getClassifier() );
assertEquals( "testClassifier",
( (Artifact) ee.evaluate( "${project.artifactMap(testGroup:testArtifact:testClassifier)}" ) ).getClassifier() );
}
private MavenProject createDefaultProject() private MavenProject createDefaultProject()
{ {
return new MavenProject( new Model() ); return new MavenProject( new Model() );
@ -440,20 +416,6 @@ public class PluginParameterExpressionEvaluatorTest
return factory.createDependencyArtifact( dependency ); return factory.createDependencyArtifact( dependency );
} }
protected Artifact createArtifact( String groupId, String artifactId, String version, String classifier )
throws Exception
{
Dependency dependency = new Dependency();
dependency.setGroupId( groupId );
dependency.setArtifactId( artifactId );
dependency.setVersion( version );
dependency.setClassifier( classifier );
dependency.setType( "jar" );
dependency.setScope( "compile" );
return factory.createDependencyArtifact( dependency );
}
private MojoExecution newMojoExecution() private MojoExecution newMojoExecution()
{ {
PluginDescriptor pd = new PluginDescriptor(); PluginDescriptor pd = new PluginDescriptor();