brett       2005/04/05 01:43:32

  Modified:    maven-core/src/test/java/org/apache/maven/project
                        ProjectClasspathTest.java
               
maven-artifact/src/main/java/org/apache/maven/artifact/construction
                        ArtifactConstructionSupport.java
  Log:
  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.
  
  Revision  Changes    Path
  1.7       +6 -3      
maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
  
  Index: ProjectClasspathTest.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProjectClasspathTest.java 23 Mar 2005 08:42:56 -0000      1.6
  +++ ProjectClasspathTest.java 5 Apr 2005 08:43:32 -0000       1.7
  @@ -66,11 +66,14 @@
           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" );
  
  
  
  1.6       +10 -7     
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java
  
  Index: ArtifactConstructionSupport.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ArtifactConstructionSupport.java  1 Apr 2005 00:24:44 -0000       1.5
  +++ ArtifactConstructionSupport.java  5 Apr 2005 08:43:32 -0000       1.6
  @@ -30,8 +30,8 @@
           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 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 @@
           }
           // ^^^ 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;
           }
  
  
  

Reply via email to