You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wim Deblauwe <wi...@gmail.com> on 2008/11/05 11:40:32 UTC

Maven picking test classifier dependencies twice

Hi,

I am seeing a really strange problem with Maven in a multimodule build.
(Using 2.0.8 or 2.0.9)

I have a multimodule with some submodules:

+ parent
  + server-common
  + module 1
  + module 2
  + ...

Both 'module 1' and 'module 2' depend on server-common and the test classes
exposed by server-common. The strange thing is that module 1 builds
correctly and module 2 does not. Both have this same dependency in their
pom.xml:

<dependency>
  <groupId>com.mycomp.server</groupId>
  <artifactId>server-common</artifactId>
</dependency>
<dependency>
  <groupId>com.mycomp.server</groupId>
  <artifactId>server-common</artifactId>
  <classifier>tests</classifier>
  <scope>test</scope>
</dependency>

Now the build succeeds:
- If you build from module 1 directory
- If you build from module 2 directory
- If you build from the parent using "mvn clean install -Pintegration"

The build fails:
- If you build from the parent with "mvn clean deploy site -Pintegration"

I ran maven with the DEBUG output enabled and saw this:

[INFO] [compiler:testCompile]
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories: [C:\jb\tms2\server\managementgrid\src\test\java]

[DEBUG] Classpath: [C:\jb\tms2\server\managementgrid\target\test-classes
 C:\jb\tms2\server\managementgrid\target\classes
...(other dependencies here)
 C:\Documents and
Settings\jbe\.m2\repository\com\traficon\tmsng\server-common\1.0-SNAPSHOT\server-common-1.0-SNAPSHOT-tests.jar
...(other dependencies here)
 C:\Documents and
Settings\jbe\.m2\repository\com\traficon\tmsng\server-common\1.0-SNAPSHOT\server-common-1.0-SNAPSHOT-tests.jar
 C:\jb\tms2\server\server-logging\target\server-logging-1.0-SNAPSHOT.jar
...(other dependencies here)
[DEBUG] Output directory:
C:\jb\tms2\server\managementgrid\target\test-classes

(managementgrid is module 2 that does not build)

As you can see, server-common is added 2 times, but only with the tests
classifier. The normal server-common.jar is not added.

What is also strange is that 'server-logging' (which is also part of the
multimodule) is added as a dependency referenced from the target directory
(and not from the local repo), but server-common is referenced from the
local repo.


Anybody who can shed some light in this case would really make my day :)

regards,

Wim