Monday, June 22, 2009

Base Test Class with Maven

I've got some base Test classes (with settings for Spring, Wicket, etc) that I want to reuse in my integration tests, and I've put them under a 'test' directory (instead of 'main'), but that means that they don't get built and included in the main artifact. Here's how I forced Maven to build it into a test artifact (in the build/plugins section):


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>


... and here's how I included it as a dependency in the other projects:


<dependency>
<groupId>com.max.services</groupId>
<artifactId>MaxServices</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>

No comments: