Reason: Our project is using Ant as commandline interface. After making a new assembly with maven's assembly plugin, I want to make initial tests to see if all has been properly assembled. Therefore I need to include the unit tests in the final assembly. After assembling, the initial tests would then be called sth like
> ant initTest
<target="initTest"> <junit> <test class="MyTest" /> </junit> </target>
Problem is: I want to keep my Unit tests in src/test/java and not move them to src/main/java. Is there a way to tell the assembly plugin to include my unit tests? A simple include in the assembly descriptor does not do it ...
There are two steps:
- Package the tests into a jar as well as the main code.
- Depend on that "-tests" jar in the module that makes the assembly.
To package up the tests, you need to bin the jar:test-jar goal. e.g.
Then in the assembly module, you can depend on the resulting artifact.
The key bit is the "classifier".