I have projects A and B where B requires A. Inside project A I have a utility-class UC that should only be available for JUnit-tests and, therefore, resides in src/test/java
of project A. As long as I write tests in A I have access to UC. However, if I run Maven and want it to execute the tests in B, I get compiler errors since UC is not accessible in B.
Obviously Eclipse includes all classes in all source folders when it compiles something (i.e., it knows about UC when I write tests in B), while Maven removes all test-classes in the final version of A.
My question is this: what do I need to do to have UC accessible in B when I run its tests with Maven?
Please understand that I'm new to Maven and I think that similar questions have been asked. However, I can't convert what is written there into my problem and fix it.
I hope it's clear what I'm trying to do...
After looking some more I finally found a solution:
http://www.waltercedric.com/java-j2ee-mainmenu-53/361-maven-build-system/1349-maven-reusing-test-classes-across-multi-modules-projects.html 1
I've seen this pattern occasionally on other questions, so I guess I just didn't understand it that way... Oh, well. *eyeroll*
1 That original link stopped working. I found it again on archive.org (don't mind the awkward layout).