You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dmitry Batrak <ba...@gmail.com> on 2012/12/04 21:00:19 UTC

Wrong resolution of dependency scope by Maven 3?

Hi,

While trying to migrate a project from Maven 2 to Maven 3, I
encountered a problem, the essence of which can be demonstrated by the
following simple example.
Consider the following POM:

<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>A</artifactId>
    <version>1.0</version>

    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-xmlbeans</artifactId>
            <version>1.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
            <version>1.5</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>

Running 'mvn dependency:resolve' for this POM yields a strange result.
Namely, it says that that my module depends on
geronimo-stax-api_1.0_spec with 'compile' scope.
This artifact is a transitive dependency of both axis2-xmlbeans and
axis2-codegen, and, according to rules for transitive dependencies, I
would expect the resolved scope of geronimo-stax-api_1.0_spec to be
'provided'. With Maven 2 I get exactly the result I expect.

Should I raise a JIRA ticket for this issue, or am I missing some
point, and this is the desired behaviour in the new version of Maven?

For reference - I used Maven version 3.0.4. I also checked the above
with the latest version (2.6) of dependency plugin - result was the
same.

Best regards,
Dmitry Batrak

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Wrong resolution of dependency scope by Maven 3?

Posted by Anders Hammar <an...@hammar.net>.
First I thought this could be a problem in the dependency plugin, but I see
the same result when viewing this in the dependency hierachy of m2e (which
uses Maven 3.0.4). Seems to be a bug - you should file a ticket.

/Anders


On Tue, Dec 4, 2012 at 9:00 PM, Dmitry Batrak <ba...@gmail.com> wrote:

> Hi,
>
> While trying to migrate a project from Maven 2 to Maven 3, I
> encountered a problem, the essence of which can be demonstrated by the
> following simple example.
> Consider the following POM:
>
> <project>
>     <modelVersion>4.0.0</modelVersion>
>
>     <groupId>test</groupId>
>     <artifactId>A</artifactId>
>     <version>1.0</version>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.apache.axis2</groupId>
>             <artifactId>axis2-xmlbeans</artifactId>
>             <version>1.5</version>
>             <scope>provided</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.axis2</groupId>
>             <artifactId>axis2-codegen</artifactId>
>             <version>1.5</version>
>             <exclusions>
>                 <exclusion>
>                     <groupId>org.apache.geronimo.specs</groupId>
>                     <artifactId>geronimo-stax-api_1.0_spec</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>     </dependencies>
> </project>
>
> Running 'mvn dependency:resolve' for this POM yields a strange result.
> Namely, it says that that my module depends on
> geronimo-stax-api_1.0_spec with 'compile' scope.
> This artifact is a transitive dependency of both axis2-xmlbeans and
> axis2-codegen, and, according to rules for transitive dependencies, I
> would expect the resolved scope of geronimo-stax-api_1.0_spec to be
> 'provided'. With Maven 2 I get exactly the result I expect.
>
> Should I raise a JIRA ticket for this issue, or am I missing some
> point, and this is the desired behaviour in the new version of Maven?
>
> For reference - I used Maven version 3.0.4. I also checked the above
> with the latest version (2.6) of dependency plugin - result was the
> same.
>
> Best regards,
> Dmitry Batrak
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>