I'm new to Maven, and I'm trying to convert several projects to work on Maven, and I'm not sure if this is the right way to structure them. Here is what I have:
I have a common module called Common and two different applications that have nothing to do with the fact that both of them depend on Common . Call them A and B
The dependencies between A → Common and B → Common are fulfilled both for runtime and for tests - this means that for classes A for testing Common test classes are required.
I tried various combinations that I could think of, but not of them produced what I want. It is strange that my code compiles, but JUnits fail because the test classes from Common not found in the classpath.
Should I add 2 profiles in Common to create 2 artifacts and add 2 dependencies in A and B to both artifacts? (Is this possible?) Is there a right way to do what I wanted? Should I rebuild my code to match Maven?
source share