Maven test dependency in multi module project

Posted by user209947 on Stack Overflow See other posts from Stack Overflow or by user209947
Published on 2009-11-12T21:17:06Z Indexed on 2010/03/28 10:03 UTC
Read the original article Hit count: 307

Filed under:
|

I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope.

Module 2 -

   <dependency>
        <groupId>blah</groupId>
        <artifactId>MODULE1</artifactId>
        <version>blah</version>
        <classifier>tests</classifier>
        <scope>test</scope>
    </dependency>

This works fine. Say my module 3 depends on Module1 src and tests at compile time.

Module 3 -

   <dependency>
        <groupId>blah</groupId>
        <artifactId>MODULE1</artifactId>
        <version>blah</version>
        <classifier>tests</classifier>
        <scope>complie</scope>
    </dependency>

When I run mvn clean install, my build runs till module 3, fails at module 3 as it couldnt resolve the module 1 test dependency. Then I do a mvn install on module 3 alone, go back and run mvn install on my parent pom to make it build. How can i fix this?

© Stack Overflow or respective owner

Related posts about maven-2

Related posts about maven-plugin