mirror of https://github.com/apache/maven.git
actually, test deps are transitive, just not for other test deps
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163496 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24a8a801e9
commit
e8a0f65e58
|
@ -116,7 +116,8 @@ public class MavenMetadataSource
|
|||
protected Artifact createArtifact( Dependency dependency, String scope, ArtifactRepository localRepository )
|
||||
{
|
||||
// TODO: can refactor
|
||||
if ( Artifact.SCOPE_TEST.equals( scope ) )
|
||||
String requestedScope = dependency.getScope();
|
||||
if ( Artifact.SCOPE_TEST.equals( scope ) && Artifact.SCOPE_TEST.equals( requestedScope ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -124,7 +125,7 @@ public class MavenMetadataSource
|
|||
// TODO: duplicated with the ArtifactFactory, localRepository not used (should be used here to resolve path?
|
||||
// TODO: scope handler
|
||||
String desiredScope = Artifact.SCOPE_RUNTIME;
|
||||
if ( Artifact.SCOPE_TEST.equals( dependency.getScope() ) )
|
||||
if ( Artifact.SCOPE_TEST.equals( requestedScope ) || Artifact.SCOPE_TEST.equals( scope ) )
|
||||
{
|
||||
desiredScope = Artifact.SCOPE_TEST;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ import java.util.Iterator;
|
|||
/**
|
||||
* @todo relocate to maven-artifact in entirety
|
||||
*/
|
||||
public class ProjectClasspathTest extends MavenTestCase
|
||||
public class ProjectClasspathTest
|
||||
extends MavenTestCase
|
||||
{
|
||||
|
||||
private String dir = "src/test/resources/projects/scope/";
|
||||
|
@ -57,15 +58,15 @@ public class ProjectClasspathTest extends MavenTestCase
|
|||
checkArtifactIdScope( project, "runtime", "runtime" );
|
||||
checkArtifactIdScope( project, "default", "compile" );
|
||||
|
||||
// check all transitive deps of a test dependency are skipped
|
||||
artifact = getArtifact( project, "maven-test-test", "scope-compile" );
|
||||
assertNull( "Check no test dependencies are transitive", artifact );
|
||||
// check all transitive deps of a test dependency are test, except test which is skipped
|
||||
artifact = getArtifact( project, "maven-test-test", "scope-test" );
|
||||
assertNull( "Check no test dependencies are transitive", artifact );
|
||||
artifact = getArtifact( project, "maven-test-test", "scope-compile" );
|
||||
assertEquals( "Check scope", "test", artifact.getScope() );
|
||||
artifact = getArtifact( project, "maven-test-test", "scope-default" );
|
||||
assertNull( "Check no test dependencies are transitive", artifact );
|
||||
assertEquals( "Check scope", "test", artifact.getScope() );
|
||||
artifact = getArtifact( project, "maven-test-test", "scope-runtime" );
|
||||
assertNull( "Check no test dependencies are transitive", artifact );
|
||||
assertEquals( "Check scope", "test", artifact.getScope() );
|
||||
|
||||
// check all transitive deps of a runtime dependency are runtime scope, except for test
|
||||
checkGroupIdScope( project, "runtime", "runtime" );
|
||||
|
|
Loading…
Reference in New Issue