vendredi 3 avril 2020

Is it possible to create a jar for test classes that contains the test dependencies using maven?

I've managed to create a jar containing the class files with dependencies and a separate jar containing the test classes for a java system. I'm trying to execute the test classes from the command line using JUnit, like so:

java -cp <test-classes-jar>:<junit-jar>:<hamcrest-jar> org.junit.runner.JUnitCore TestClass

However, the test cases won't execute due to the tests using google truth, resulting in a class not found error. I know I can work around this by appending the jar to google truth onto the class path, but I'd like to avoid this.

Is there a way to generate a single jar which contains the test classes their dependencies?

Aucun commentaire:

Enregistrer un commentaire