I would like to produce a fat/standalone jar which contains both my test classes and test-scope dependencies. Using the maven-jar-plugin, I can create a jar which contains my test classes but it does not contain dependencies. Reading the internet, appears the solution is to combine maven-jar-plugin with maven-assembly-plugin.
I tried following these instructions https://jitblog.net/build-maven-standalone-tests/ but have had no success. Here is a repro of my issue: https://github.com/yanakad/commons-compress-test
- Run
mvn clean package
- Expected: target/fatJar.jar will contain both SnakeYaml and TestClass
- Observed: SnakeYaml is indeed there but TestClass is not
My maven version is Apache Maven 3.6.0
Looking at the maven execution, it seems that
`[INFO] --- maven-assembly-plugin:3.2.0:single (fat-testjar) @ compress-test ---`
is run before
`[INFO] --- maven-jar-plugin:3.2.0:test-jar (default) @ compress-test ---`
Not sure if that's the cause or a red herring, or how to fix...Any insight much appreciated