I use the shade maven plugin to build my project so that all of its dependencies are included in one jar (this makes it easier to run it on Hadoop). Shade seems to exclude my test code by default, which is understandable. Since I would like to run integration tests against my cluster, I am hoping to setup another profile to build a separate jar for this purpose. Is there any way to configure this plugin to also include test code?
With version 2.2 of the maven-shade-plugin, they added a "shadeTestJar" option (see MSHADE-158): http://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#shadeTestJar
However, I tried using this and couldn't get it to work. Here's my plugin config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadeTestJar>true</shadeTestJar>
</configuration>
</execution>
</executions>
</plugin>
The "...-tests.jar" file has no entries, but the main shaded jar looks fine (although it doesn't contain any test classes).
Also, this question duplicates this other question, although the accepted answer isn't real satisfying: How to include test classes in Jar created by maven-shade-plugin?