We are using classifiers in our builds to distinguish our artifacts. The problem is that we are also using the maven-jar plugin to create a test-jar which has some test classes we use elsewhere. Since the test-jar
goal uses classifiers to distinguish these artifacts, we get a conflict.
Looking at the documentation, test-jar
is not the preferred way of distributing test classes. The test classes we want to re-use extend JUnit classes. So if I put them in their own non-test module, then their test cases won't run, but if I put them in their own module in the test directory, then I'm in the same situation where I'm creating the jar with test-jar
goal.
How do I refactor these classes such that I can still run them in JUnit from the original location, and re-use them elsewhere?