You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hardy Ferentschik (JIRA)" <ji...@codehaus.org> on 2009/10/08 18:02:38 UTC

[jira] Created: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Have the abiltiy to remove a dependency from the test classpath (at least optional ones
---------------------------------------------------------------------------------------

                 Key: SUREFIRE-576
                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
             Project: Maven Surefire
          Issue Type: New Feature
          Components: classloading
            Reporter: Hardy Ferentschik




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier reopened SUREFIRE-576:
--------------------------------


Thanks for testing this.  You're right my logic was correct for the individual dependency excludes but reversed for the scope excludes.  The missing combined scopes is probably because surefire is using an older version of the scope filter, so I'll update this also.

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier closed SUREFIRE-576.
------------------------------

    Resolution: Fixed

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221825#action_221825 ] 

Paul Gier commented on SUREFIRE-576:
------------------------------------

I deployed a new snapshot to the snapshots repository (https://repository.apache.org/content/repositories/snapshots/)

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221975#action_221975 ] 

Paul Gier commented on SUREFIRE-576:
------------------------------------

Another update in [r946778|http://svn.apache.org/viewvc?view=revision&revision=946778]

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "A (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221900#action_221900 ] 

A edited comment on SUREFIRE-576 at 5/20/10 4:49 AM:
-----------------------------------------------------

Hello,

I've tested the changes today. It seems like the filter is actually including what user chooses in the exclude elements.

{code}
    private Set filterArtifacts( Set artifacts, ArtifactFilter filter )
    {
        Set filteredArtifacts = new LinkedHashSet();

        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
        {
            Artifact artifact = (Artifact) iter.next();
            if ( filter.include( artifact ) )
            {
                filteredArtifacts.add( artifact );
            }
        }

        return filteredArtifacts;
    }
{code}

Perhaps you intended it as "if ( ! filter.include( artifact ) )"?

Another glitch I'm seeing is that description of the scope excludes element is misleading. compile+runtime doesn't seem to be recognized as a valid option for filtering but "runtime" alone is what works for me. Also I can't make "runtime+system" working neither "system". I've no why.

Thanks!

      was (Author: avalon):
    Hello,

I've tested the changes today. It seems like the filter is actually including what user chooses in the exclude elements.

[code]
    private Set filterArtifacts( Set artifacts, ArtifactFilter filter )
    {
        Set filteredArtifacts = new LinkedHashSet();

        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
        {
            Artifact artifact = (Artifact) iter.next();
            if ( filter.include( artifact ) )
            {
                filteredArtifacts.add( artifact );
            }
        }

        return filteredArtifacts;
    }
[/code]

Perhaps you intended it as "if ( ! filter.include( artifact ) )"?

Another glitch I'm seeing is that description of the scope excludes element is misleading. compile+runtime doesn't seem to be recognized as a valid option for filtering but "runtime" alone is what works for me. Also I can't make "runtime+system" working neither "system". I've no why.

Thanks!
  
> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Hardy Ferentschik (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221821#action_221821 ] 

Hardy Ferentschik commented on SUREFIRE-576:
--------------------------------------------

Cool. What's the timeline for 2.6? Or is there a SNAPSHOT I could try?

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "A (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221915#action_221915 ] 

A commented on SUREFIRE-576:
----------------------------

Actually I see the issue better now. For scope ExcludesArtifactFilter is used and for individual artifacts ExcludesArtifactFilter is used so it seems either a new method needs to be created or ExcludesArtifactFilter changed to IncludesArtifactFilter and filterArtifacts() to reflect that.

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "A (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222001#action_222001 ] 

A commented on SUREFIRE-576:
----------------------------

I've tested the new commit. It appears to be working for my purposes - testing a packaged for distribution product rather than the project compiled classes. Thank you for implementing this feature!

I'm putting below a sample configuration just for a reference. I see that system dependencies can be excluded either by the "test" scope or with their group and artifact id. Also the build classes can be excluded by configuring a fake location for them and although looking hacky, this method seems reasonable to me.

{code:xml}
    <profile>
      <id>product-test</id>
      <activation>
         <activeByDefault>false</activeByDefault>
      </activation>
      <build>
         <plugins>
            <plugin>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>2.6-SNAPSHOT</version>
               <configuration>
                  <classesDirectory>fakeClassesDirectory</classesDirectory>
                  <!-- testClassesDirectory>fakeTestClassesDirectory</testClassesDirectory -->
                  <classpathDependencyScopeExclude>runtime</classpathDependencyScopeExclude>
                  <classpathDependencyExcludes>
                     <exclude>org.apache.commons:*</exclude>
                     <exclude>testGrp:testId</exclude>
                  </classpathDependencyExcludes>
                  <additionalClasspathElements>
                     <additionalClasspathElement>/path/to/product/installation/artifact1.jar</additionalClasspathElement>
                     <additionalClasspathElement>/path/to/product/installation/artifact2.jar</additionalClasspathElement>
                  </additionalClasspathElements>
               </configuration>
            </plugin>
         </plugins>
      </build>
    </profile>
{code}

Then tester should look at the mvn -Pproduct-test -X output (search for "Test Classpath")to verify classpath is what's expected. btw it will become more convenient once MNG-2570 is resolved and debug logging only from the SurefirePlugin class can be enabled through CLI rather than full debug of everything.

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier updated SUREFIRE-576:
-------------------------------

    Fix Version/s:     (was: 2.5.1)
                   2.6

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier updated SUREFIRE-576:
-------------------------------

      Component/s: Maven Surefire Plugin
    Fix Version/s: 2.5.1
         Assignee: Paul Gier

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.5.1
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "A (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221915#action_221915 ] 

A edited comment on SUREFIRE-576 at 5/20/10 8:14 AM:
-----------------------------------------------------

Actually I see the issue better now. For scope ExcludesArtifactFilter is used and for individual artifacts ExcludesArtifactFilter is used so it seems either a new method needs to be created or ExcludesArtifactFilter changed to IncludesArtifactFilter and filterArtifacts() to reflect that.

For the second issue with scope names I tried using maven 2.2.1 but still I can't make a system artifact to be excluded.

      was (Author: avalon):
    Actually I see the issue better now. For scope ExcludesArtifactFilter is used and for individual artifacts ExcludesArtifactFilter is used so it seems either a new method needs to be created or ExcludesArtifactFilter changed to IncludesArtifactFilter and filterArtifacts() to reflect that.
  
> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier closed SUREFIRE-576.
------------------------------

    Resolution: Fixed

Fixed in [r945404|http://svn.apache.org/viewvc?view=revision&revision=945404].

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Hardy Ferentschik (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=194061#action_194061 ] 

Hardy Ferentschik commented on SUREFIRE-576:
--------------------------------------------

BTW, I know that I can get it working to a certain degree unsing profiles, but the resulting pom just looks terrible.

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading
>            Reporter: Hardy Ferentschik
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "Hardy Ferentschik (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=194059#action_194059 ] 

Hardy Ferentschik commented on SUREFIRE-576:
--------------------------------------------

Forgot to describe a usecase. Say you are developing a library and you have an optional dependency to another library. Depending on whether this optional library is used at runtime your own library behaves differently. In this scenario I would like to have two test sets. One where the tests are run with the optional dependency on the classpath and one without. It is already possible two configure two executions of the surefire plugin, but I cannot remove a dependency. Basically optional dependencies should be removable via some excludes configuration. 

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading
>            Reporter: Hardy Ferentschik
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-576) Have the abiltiy to remove a dependency from the test classpath (at least optional ones

Posted by "A (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=221900#action_221900 ] 

A commented on SUREFIRE-576:
----------------------------

Hello,

I've tested the changes today. It seems like the filter is actually including what user chooses in the exclude elements.

[code]
    private Set filterArtifacts( Set artifacts, ArtifactFilter filter )
    {
        Set filteredArtifacts = new LinkedHashSet();

        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
        {
            Artifact artifact = (Artifact) iter.next();
            if ( filter.include( artifact ) )
            {
                filteredArtifacts.add( artifact );
            }
        }

        return filteredArtifacts;
    }
[/code]

Perhaps you intended it as "if ( ! filter.include( artifact ) )"?

Another glitch I'm seeing is that description of the scope excludes element is misleading. compile+runtime doesn't seem to be recognized as a valid option for filtering but "runtime" alone is what works for me. Also I can't make "runtime+system" working neither "system". I've no why.

Thanks!

> Have the abiltiy to remove a dependency from the test classpath (at least optional ones
> ---------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-576
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-576
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: classloading, Maven Surefire Plugin
>            Reporter: Hardy Ferentschik
>            Assignee: Paul Gier
>             Fix For: 2.6
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira