using pom for test scope dependencies

Posted by IttayD on Stack Overflow See other posts from Stack Overflow or by IttayD
Published on 2010-05-03T16:27:39Z Indexed on 2010/05/04 6:58 UTC
Read the original article Hit count: 298

Filed under:
|

Hi,

Is it possible to create a pom file so it can be used inside another pom to add test scope dependencies?

So in module E's pom.xml I have:

<dependencies>
  <dependency>
    <groupId>com.example</artifactId>
    <artifactId>D</artifactId>
    <type>pom</type>
    <scope>test</scope>
  </dependency>
</dependencies>   

So that if D's pom.xml contains dependencies on artifacts A, B, C, then these artifacts are in the compilation and execution classpath of E's tests.

NOTE: the reason I want such a pom, and not rely on regular dependency resolution is that I have created a tests jar using maven-jar-plugin:test-jar and using that jar as a dependency causes maven to not use its transitive dependencies. (see http://jira.codehaus.org/browse/MNG-1378)

UPDATE: this does not work for me (maybe because I'm trying to use it for the test scope): http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html

© Stack Overflow or respective owner

Related posts about maven

Related posts about maven-2