| maven2 Unit Test code reuse and dependencies |
|
|
| Thursday, 10 April 2008 14:52 | ||||||||||
|
Maven rules of the game:
The solution is to create additional test jar for each module, this is done by putting in the inside the <build></build> tags the following: 1: <plugin> 2: <groupId>org.apache.maven.plugins</groupId> 3: <artifactId>maven-jar-plugin</artifactId> 4: <executions> 5: <execution> 6: <goals> 7: <goal>test-jar</goal> 8: </goals> 9: </execution> 10: </executions> 11: </plugin> This will create for each modules an additional jar named {artifactId}-{version}-tests.jar
Now for every modules where you want to reuse test classes, all you have to do in to put in every
1: <dependency> 2: <groupId>yourGroup</groupId> 3: <artifactId>yourReusableModuleArtifact</artifactId> 4: <version>0.1-SNAPSHOT</version> 5: <classifier>tests</classifier> 6: <scope>test</scope> 7: </dependency> This has work for me with Maven 2.0.8
Powered by !JoomlaComment 3.20
3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."
|
| Another articles: |
|---|
|
| Powered By relatedArticle |












Tags
