You do not need to create separate module, but you need to tell maven/m2e that dependency uses test classes/resources. You do this by adding tests classifier as explained in [1]. So in your example you'll need to have the following in project2/pom.xml

...
    <dependency>
      <groupId>com.myco.app</groupId>
      <artifactId>project1</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>com.myco.app</groupId>
      <artifactId>project1</artifactId>
      <version>1.0-SNAPSHOT</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
...


[1] http://maven.apache.org/guides/mini/guide-attached-tests.html

Leszek Gawron wrote:
Igor Fedorenko wrote:
Yes, parity between m2e and maven cli is high priority for us. Classifier=tests makes test classes/resources visible to dependent projects both in m2e and cli, so your scenario should work. Are there reasons you cannot or prefer not to use tests classifier?

do you mean classifer=test or scope=test? In my solution I didn't have to create separate modules with resources imported with scope=test. CLI was totally irrelevant for me (I'm not using those resources in tests, rather in utility classes).

I probably rework my project (create separate modules for test only dependencies) so it is more elegant and CLI friendly.

Thanks.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to