Search code examples
mavenmaven-surefire-plugin

Generate test-jar along with jar file in test package


I want to package my test package to jar file . How to execute generate test-jar from maven plugin Surefire.


Solution

  • You can add following entries to your pom:

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