I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope.
Module 2 -
<
As https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html says:
How to create a jar containing test classes When you want to create a jar containing test-classes, you would probably want to reuse those classes. There are two ways to solve this:
The easy way
Create an attached jar with the test-classes from the current project and loose its transitive test-scoped dependencies.
The preferred way
Create a separate project with the test-classes.
Please read that article for detail.