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

Reply via email to