You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Garrett Wu <wu...@gmail.com> on 2011/05/18 03:01:19 UTC
exclusions from a test-jar dependency in maven 3
When upgrading to maven 3.0.3, I noticed that <exclusions> are not really
excluded from dependencies with <type>test-jar</type>. Is this intended
behavior? If so, I how should I achieve the same effect as maven2?
I have a project maven-test-jar that has a compile scope dependency on
org.apache.hadoop:avro:1.3.1.
<groupId>com.foocorp.maven</groupId>
<artifactId>maven-test-jar</artifactId>
<!-- ... -->
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>avro</artifactId>
<version>1.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
I have another project that depends on maven-test-jar's tests, and I would
like to use org.apache.avro:avro:1.4.1 instead of
org.apache.hadoop:avro:1.3.1.
<!-- ... -->
<dependencies>
<dependency>
<groupId>com.foocorp.maven</groupId>
<artifactId>maven-test-jar</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
<type>test-jar</type>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>avro</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
However, a dependency:list shows that it still uses
org.apache.hadoop:avro:1.3.1 for the test scope:
$ mvn dependency:list
...
[INFO] org.apache.avro:avro:jar:1.4.1:compile
[INFO] org.apache.hadoop:avro:jar:1.3.1:test
...
In maven 2, org.apache.hadoop:avro:jar:1.3.1:test is omitted as I would
expect.
Thanks,
Garrett
Re: exclusions from a test-jar dependency in maven 3
Posted by Garrett Wu <wu...@gmail.com>.
Thanks. I've filed http://jira.codehaus.org/browse/MNG-5096.
On Wed, May 18, 2011 at 12:19 PM, Anders Hammar <an...@hammar.net> wrote:
> I the exact same project shows a difference between Maven 2.2.1 and Maven
> 3.0.3, you should create a jira ticket about a regression.
>
> /Anders
>
> On Wed, May 18, 2011 at 03:01, Garrett Wu <wu...@gmail.com> wrote:
>
> > When upgrading to maven 3.0.3, I noticed that <exclusions> are not really
> > excluded from dependencies with <type>test-jar</type>. Is this intended
> > behavior? If so, I how should I achieve the same effect as maven2?
> >
> > I have a project maven-test-jar that has a compile scope dependency on
> > org.apache.hadoop:avro:1.3.1.
> >
> > <groupId>com.foocorp.maven</groupId>
> > <artifactId>maven-test-jar</artifactId>
> > <!-- ... -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.hadoop</groupId>
> > <artifactId>avro</artifactId>
> > <version>1.3.1</version>
> > <scope>compile</scope>
> > </dependency>
> > </dependencies>
> >
> > I have another project that depends on maven-test-jar's tests, and I
> would
> > like to use org.apache.avro:avro:1.4.1 instead of
> > org.apache.hadoop:avro:1.3.1.
> >
> > <!-- ... -->
> > <dependencies>
> > <dependency>
> > <groupId>com.foocorp.maven</groupId>
> > <artifactId>maven-test-jar</artifactId>
> > <version>1.0-SNAPSHOT</version>
> > <scope>test</scope>
> > <type>test-jar</type>
> > <exclusions>
> > <exclusion>
> > <groupId>org.apache.hadoop</groupId>
> > <artifactId>avro</artifactId>
> > </exclusion>
> > </exclusions>
> > </dependency>
> > <dependency>
> > <groupId>org.apache.avro</groupId>
> > <artifactId>avro</artifactId>
> > <version>1.4.1</version>
> > <scope>compile</scope>
> > </dependency>
> > </dependencies>
> >
> > However, a dependency:list shows that it still uses
> > org.apache.hadoop:avro:1.3.1 for the test scope:
> >
> > $ mvn dependency:list
> > ...
> > [INFO] org.apache.avro:avro:jar:1.4.1:compile
> > [INFO] org.apache.hadoop:avro:jar:1.3.1:test
> > ...
> >
> > In maven 2, org.apache.hadoop:avro:jar:1.3.1:test is omitted as I would
> > expect.
> >
> > Thanks,
> > Garrett
> >
>
Re: exclusions from a test-jar dependency in maven 3
Posted by Anders Hammar <an...@hammar.net>.
I the exact same project shows a difference between Maven 2.2.1 and Maven
3.0.3, you should create a jira ticket about a regression.
/Anders
On Wed, May 18, 2011 at 03:01, Garrett Wu <wu...@gmail.com> wrote:
> When upgrading to maven 3.0.3, I noticed that <exclusions> are not really
> excluded from dependencies with <type>test-jar</type>. Is this intended
> behavior? If so, I how should I achieve the same effect as maven2?
>
> I have a project maven-test-jar that has a compile scope dependency on
> org.apache.hadoop:avro:1.3.1.
>
> <groupId>com.foocorp.maven</groupId>
> <artifactId>maven-test-jar</artifactId>
> <!-- ... -->
> <dependencies>
> <dependency>
> <groupId>org.apache.hadoop</groupId>
> <artifactId>avro</artifactId>
> <version>1.3.1</version>
> <scope>compile</scope>
> </dependency>
> </dependencies>
>
> I have another project that depends on maven-test-jar's tests, and I would
> like to use org.apache.avro:avro:1.4.1 instead of
> org.apache.hadoop:avro:1.3.1.
>
> <!-- ... -->
> <dependencies>
> <dependency>
> <groupId>com.foocorp.maven</groupId>
> <artifactId>maven-test-jar</artifactId>
> <version>1.0-SNAPSHOT</version>
> <scope>test</scope>
> <type>test-jar</type>
> <exclusions>
> <exclusion>
> <groupId>org.apache.hadoop</groupId>
> <artifactId>avro</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
> <dependency>
> <groupId>org.apache.avro</groupId>
> <artifactId>avro</artifactId>
> <version>1.4.1</version>
> <scope>compile</scope>
> </dependency>
> </dependencies>
>
> However, a dependency:list shows that it still uses
> org.apache.hadoop:avro:1.3.1 for the test scope:
>
> $ mvn dependency:list
> ...
> [INFO] org.apache.avro:avro:jar:1.4.1:compile
> [INFO] org.apache.hadoop:avro:jar:1.3.1:test
> ...
>
> In maven 2, org.apache.hadoop:avro:jar:1.3.1:test is omitted as I would
> expect.
>
> Thanks,
> Garrett
>