MNG-5214: Dependency resolution substitutes g🅰️v:jar for j🅰️v:something-else when something-else isn't in the reactor

o allow ejb-client types artifacts to dance with jar artifacts to allow reactor resolution to target/classes, thus
unbreaking some integration tests.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1212793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benson Margulies 2011-12-10 13:54:49 +00:00
parent acb711f32c
commit a15a2646a3
1 changed files with 8 additions and 7 deletions

View File

@ -27,6 +27,7 @@ import org.sonatype.aether.repository.WorkspaceRepository;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -42,6 +43,9 @@ import java.util.Map;
class ReactorReader class ReactorReader
implements WorkspaceReader implements WorkspaceReader
{ {
private final static Collection<String> JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" );
private final static Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
private Map<String, MavenProject> projectsByGAV; private Map<String, MavenProject> projectsByGAV;
@ -99,7 +103,8 @@ class ReactorReader
} }
else else
{ {
if ( project.hasLifecyclePhase( "compile" ) && artifact.getProperty( "type", "").equals( "jar" ) ) /* also reject non-"" classifier? */ String type = artifact.getProperty( "type", "");
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
{ {
return new File( project.getBuild().getOutputDirectory() ); return new File( project.getBuild().getOutputDirectory() );
} }
@ -194,11 +199,7 @@ class ReactorReader
{ {
typeOk = true; typeOk = true;
} }
else if ( "test-jar".equals ( requestedType ) && "jar".equals( attachedType ) ) else if ( JAR_LIKE_TYPES.contains( requestedType ) && JAR_LIKE_TYPES.contains( attachedType ) )
{
typeOk = true;
}
else if ( "jar".equals ( requestedType ) && "test-jar".equals( attachedType ) )
{ {
typeOk = true; typeOk = true;
} }