You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Kevin Stembridge (JIRA)" <ji...@codehaus.org> on 2007/12/03 01:16:58 UTC

[jira] Created: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Provided scope doesn't filter out transitive dependencies
---------------------------------------------------------

                 Key: MANTTASKS-102
                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
             Project: Maven 2.x Ant Tasks
          Issue Type: Bug
          Components: dependencies task
    Affects Versions: 2.0.7
            Reporter: Kevin Stembridge
            Priority: Minor


Copied from a posting to the Maven users list:

I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 

My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.

{code:xml}
<target name="test">
        
    <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
        <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
    </artifact:dependencies>
    
    <copy todir="bogus" verbose="true">
        <fileset refid="copy.test.fileset" />
        <mapper type="flatten" />
    </copy>
    
</target>
{code}

I've tried the following combinations of the useScope and scope attributes:

||useScope || scope || Result||
|provided | provided | Nothing copied|
|provided | runtime | Nothing copied|
|provided | compile | Nothing copied|
|runtime | provided | Nothing copied|
|runtime | runtime | Dependency and transitives copied|
|runtime | compile | Dependency and transitives copied|
|compile | provided | Dependency and transitives copied|
|compile | runtime | Nothing copied|
|compile | compile | Dependency and transitives copied|


Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 


-- 
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: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MANTTASKS-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MANTTASKS-102:
------------------------------------

    Assignee:     (was: Herve Boutemy)

> Provided scope doesn't filter out transitive dependencies
> ---------------------------------------------------------
>
>                 Key: MANTTASKS-102
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.0.7
>            Reporter: Kevin Stembridge
>            Priority: Minor
>         Attachments: build.xml
>
>
> Copied from a posting to the Maven users list:
> I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 
> My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.
> {code:xml}
> <target name="test">
>         
>     <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
>         <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
>     </artifact:dependencies>
>     
>     <copy todir="bogus" verbose="true">
>         <fileset refid="copy.test.fileset" />
>         <mapper type="flatten" />
>     </copy>
>     
> </target>
> {code}
> I've tried the following combinations of the useScope and scope attributes:
> ||useScope || scope || Result||
> |provided | provided | Nothing copied|
> |provided | runtime | Nothing copied|
> |provided | compile | Nothing copied|
> |runtime | provided | Nothing copied|
> |runtime | runtime | Dependency and transitives copied|
> |runtime | compile | Dependency and transitives copied|
> |compile | provided | Dependency and transitives copied|
> |compile | runtime | Nothing copied|
> |compile | compile | Dependency and transitives copied|
> Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 

-- 
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: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MANTTASKS-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy closed MANTTASKS-102.
-----------------------------------

      Assignee: Herve Boutemy
    Resolution: Won't Fix

Hi Kevin,

Scopes are not intended to do what you're trying : see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html.

As I replied in the Users list : http://www.nabble.com/Maven-Ant-Tasks%3A-provided-dependencies-don%27t-exclude-trans-to14121460s177.html#a14121460, getting a simple dependency without any transitivity handling is IMHO best done simply with Ant's get task :
{code:xml}<get src="http://repo1.maven.org/maven2/org/springframework/spring/2.0.7/spring-2.0.7.jar" dest="bogus"/>{code}


> Provided scope doesn't filter out transitive dependencies
> ---------------------------------------------------------
>
>                 Key: MANTTASKS-102
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.0.7
>            Reporter: Kevin Stembridge
>            Assignee: Herve Boutemy
>            Priority: Minor
>
> Copied from a posting to the Maven users list:
> I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 
> My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.
> {code:xml}
> <target name="test">
>         
>     <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
>         <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
>     </artifact:dependencies>
>     
>     <copy todir="bogus" verbose="true">
>         <fileset refid="copy.test.fileset" />
>         <mapper type="flatten" />
>     </copy>
>     
> </target>
> {code}
> I've tried the following combinations of the useScope and scope attributes:
> ||useScope || scope || Result||
> |provided | provided | Nothing copied|
> |provided | runtime | Nothing copied|
> |provided | compile | Nothing copied|
> |runtime | provided | Nothing copied|
> |runtime | runtime | Dependency and transitives copied|
> |runtime | compile | Dependency and transitives copied|
> |compile | provided | Dependency and transitives copied|
> |compile | runtime | Nothing copied|
> |compile | compile | Dependency and transitives copied|
> Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 

-- 
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: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MANTTASKS-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy reopened MANTTASKS-102:
-------------------------------------


ok, I reopen the issue (and add you as a watcher): without any reply on the mailing list, I thought you were ok, or not motivated to work with me deeper on the question.

I totally agree with you: Maven Ant Tasks' "purpose is to make use of Maven's dependency management features, transitive dependencies being one of them".

I don't understand how you want to use scopes to avoid getting transitive dependencies.
Can you write a pom.xml showing what scope usage you would be using with Maven to get the classpath you want?
When this pom works with Maven as wanted, we'll test it with Maven Ant Tasks: if it is failing, this will give me the unit test to work on until Maven dependencies task works like Maven :)

> Provided scope doesn't filter out transitive dependencies
> ---------------------------------------------------------
>
>                 Key: MANTTASKS-102
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.0.7
>            Reporter: Kevin Stembridge
>            Assignee: Herve Boutemy
>            Priority: Minor
>
> Copied from a posting to the Maven users list:
> I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 
> My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.
> {code:xml}
> <target name="test">
>         
>     <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
>         <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
>     </artifact:dependencies>
>     
>     <copy todir="bogus" verbose="true">
>         <fileset refid="copy.test.fileset" />
>         <mapper type="flatten" />
>     </copy>
>     
> </target>
> {code}
> I've tried the following combinations of the useScope and scope attributes:
> ||useScope || scope || Result||
> |provided | provided | Nothing copied|
> |provided | runtime | Nothing copied|
> |provided | compile | Nothing copied|
> |runtime | provided | Nothing copied|
> |runtime | runtime | Dependency and transitives copied|
> |runtime | compile | Dependency and transitives copied|
> |compile | provided | Dependency and transitives copied|
> |compile | runtime | Nothing copied|
> |compile | compile | Dependency and transitives copied|
> Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 

-- 
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: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Posted by "Kevin Stembridge (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MANTTASKS-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Stembridge updated MANTTASKS-102:
---------------------------------------

    Attachment: build.xml

Hi Herve,
Thanks for reopening the issue.

I've attached a build.xml file that performs a couple of tests using the artifact:dependencies ant task to copy filesets. One test uses compile scope to copy an artifact and its transitive dependencies.

It currently assumes the following location for the maven ant tasks jar, so that is something you'll have to sort out before you run the default target of the build file.


	<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.7.jar" />
	

Cheers,
Kevin

> Provided scope doesn't filter out transitive dependencies
> ---------------------------------------------------------
>
>                 Key: MANTTASKS-102
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.0.7
>            Reporter: Kevin Stembridge
>            Assignee: Herve Boutemy
>            Priority: Minor
>         Attachments: build.xml
>
>
> Copied from a posting to the Maven users list:
> I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 
> My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.
> {code:xml}
> <target name="test">
>         
>     <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
>         <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
>     </artifact:dependencies>
>     
>     <copy todir="bogus" verbose="true">
>         <fileset refid="copy.test.fileset" />
>         <mapper type="flatten" />
>     </copy>
>     
> </target>
> {code}
> I've tried the following combinations of the useScope and scope attributes:
> ||useScope || scope || Result||
> |provided | provided | Nothing copied|
> |provided | runtime | Nothing copied|
> |provided | compile | Nothing copied|
> |runtime | provided | Nothing copied|
> |runtime | runtime | Dependency and transitives copied|
> |runtime | compile | Dependency and transitives copied|
> |compile | provided | Dependency and transitives copied|
> |compile | runtime | Nothing copied|
> |compile | compile | Dependency and transitives copied|
> Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 

-- 
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: (MANTTASKS-102) Provided scope doesn't filter out transitive dependencies

Posted by "Kevin Stembridge (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MANTTASKS-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_118849 ] 

Kevin Stembridge commented on MANTTASKS-102:
--------------------------------------------

Hi Herve,
I sent the following reply to you on the user's list but it got bounced as spam. 


{quote}
Hi Herve,
Thanks for the reply.

I'm not so sure that the purpose of the Ant tasks is to specifically get transitive dependencies. I would say that its purpose is to make use of Maven's dependency management features, transitive dependencies being one of them, but scope recognition being another. (The first paragraph on the Maven Ant Tasks site would seem to back me up on this  ). It seems to me that it is failing on the scope recognition part of it. 

The documentation on the site is pretty clear that declaring a dependency with provided scope is supposed to behave the same way for the Ant task as it does for Maven itself. So I think we've got a bug here. Even if its not a bug, it would still be nice to implement this scope recognition as per the Maven dependency mechanism. That would be much more preferable than having to add exclusion elements or perform an Ant get. As a side note, I've decided to use the Ant copy task to copy the artifacts directly from my local Maven repo.

I'm going to raise a JIRA for it and see what the dev team thinks. 
Thanks for your help and suggestions.

Kevin
{quote}

Here is the paragraph I am referring to from the top of the [Maven Ant Tasks site|http://maven.apache.org/ant-tasks.html]:

{quote}
Maven comes with a set of Ant tasks that can be used to utilise Maven's artifact handling features from within Ant. This includes:

    * Dependency management - including transitive dependencies, scope recognition and SNAPSHOT handling
    * ...
{quote}

And from under the section that describes the dependencies task:

{quote}
You can also specify a scope parameter on each dependency. This changes the behaviour of transitive dependencies and is useful for building different types of classpaths. To see how it affects the behaviour of the dependencies, see the  Dependency Mechanism  documentation in the Maven 2.0 site.
{quote}

I don't think you should be closing this issue. My opinion is that the documentation is correct and the ant tasks should be consistent with the Maven dependency mechanism. So either we have a bug or the documentation needs to change.

Cheers,
Kevin

> Provided scope doesn't filter out transitive dependencies
> ---------------------------------------------------------
>
>                 Key: MANTTASKS-102
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-102
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.0.7
>            Reporter: Kevin Stembridge
>            Assignee: Herve Boutemy
>            Priority: Minor
>
> Copied from a posting to the Maven users list:
> I'm trying to use the dependencies ant task to copy artifacts to a given location but I'm having trouble excluding transitive dependencies. 
> My understanding from the documentation is that I should be able to use the following XML to copy an artifact, without its transitives. But, nothing at all gets copied.
> {code:xml}
> <target name="test">
>         
>     <artifact:dependencies filesetId="copy.test.fileset" useScope="provided" verbose="true">
>         <dependency groupId="org.springframework" artifactId="spring" version="2.0.7" scope="provided"/>
>     </artifact:dependencies>
>     
>     <copy todir="bogus" verbose="true">
>         <fileset refid="copy.test.fileset" />
>         <mapper type="flatten" />
>     </copy>
>     
> </target>
> {code}
> I've tried the following combinations of the useScope and scope attributes:
> ||useScope || scope || Result||
> |provided | provided | Nothing copied|
> |provided | runtime | Nothing copied|
> |provided | compile | Nothing copied|
> |runtime | provided | Nothing copied|
> |runtime | runtime | Dependency and transitives copied|
> |runtime | compile | Dependency and transitives copied|
> |compile | provided | Dependency and transitives copied|
> |compile | runtime | Nothing copied|
> |compile | compile | Dependency and transitives copied|
> Note that none of these configurations gives me a dependency without any transitives. I understand that I can specify exclusion elements to exclude all the transitives but it seems to me that specifying provided scope is supposed to achieve the same goal, and would be much nicer. 

-- 
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