gone back to test dependencies not being transitive at all, as reversed in rev1.3 of ProjectClasspathTest. This enables the execution of "m2 test" not to pull in all and sundry test dependencies, eg from wagon. Find a valid use case before re-instating, and look into alternatives for the download issues.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-05 08:43:32 +00:00
parent f3d6a62892
commit b3b831ec31
2 changed files with 16 additions and 10 deletions

View File

@ -30,8 +30,8 @@ public class ArtifactConstructionSupport
return createArtifact( groupId, artifactId, version, scope, type, null, null );
}
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String scope, String type,
String classifier )
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String scope,
String type, String classifier )
{
return createArtifact( groupId, artifactId, version, scope, type, classifier, null );
}
@ -39,16 +39,17 @@ public class ArtifactConstructionSupport
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
String inheritedScope )
{
return createArtifact(groupId, artifactId, version, scope, type, null, inheritedScope);
return createArtifact( groupId, artifactId, version, scope, type, null, inheritedScope );
}
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
String classifier, String inheritedScope )
{
// TODO: can refactor, use scope handler
// if this artifact is test, and the dependency is test, don't transitively create
if ( Artifact.SCOPE_TEST.equals( inheritedScope ) && Artifact.SCOPE_TEST.equals( scope ) )
// re-instate this if test deps are propogated
// if ( Artifact.SCOPE_TEST.equals( inheritedScope ) && Artifact.SCOPE_TEST.equals( scope ) )
if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
{
return null;
}
@ -66,7 +67,9 @@ public class ArtifactConstructionSupport
}
// ^^^ added to retain compile scope. Remove if you want compile inherited as runtime
if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_TEST.equals( inheritedScope ) )
// re-instate this if test deps are propogated
// if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_TEST.equals( inheritedScope ) )
if ( Artifact.SCOPE_TEST.equals( scope ) )
{
desiredScope = Artifact.SCOPE_TEST;
}

View File

@ -66,11 +66,14 @@ public class ProjectClasspathTest
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() );
// assertEquals( "Check scope", "test", artifact.getScope() );
assertNull( "Check no test dependencies are transitive", artifact );
artifact = getArtifact( project, "maven-test-test", "scope-default" );
assertEquals( "Check scope", "test", artifact.getScope() );
// assertEquals( "Check scope", "test", artifact.getScope() );
assertNull( "Check no test dependencies are transitive", artifact );
artifact = getArtifact( project, "maven-test-test", "scope-runtime" );
assertEquals( "Check scope", "test", artifact.getScope() );
// assertEquals( "Check scope", "test", artifact.getScope() );
assertNull( "Check no test dependencies are transitive", artifact );
// check all transitive deps of a runtime dependency are runtime scope, except for test
checkGroupIdScope( project, "runtime", "runtime" );