If you have module A where you have some test classes, and module B where you wish to use this test classes. You need to use some plugin with configured goal, some scope and some type to resolve this.
So, in module A
<project> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>And in module B:<project> ... <dependencies> <dependency> <groupId>com.my.app</groupId> <artifactId>module-a</artifactId> <version>1.0-SNAPSHOT</version> <type>test-jar</type> <scope>test</scope> </dependency> </dependencies> ... </project>
Advertisement
Tags: java maven