Hi,

 

I have a project A, and a project B that depends on A. A has test code which 
includes both abstract, invariant-checking base classes and regular tests under 
src/test. Project B would like to reuse the base classes from project A's 
src/test.

 

Searching for a way to do this in maven2 without creating a nightmare forest of 
projects and dependencies, I stumbled upon the following in the ML archives:

 

http://marc.theaimsgroup.com/?l=turbine-maven-user&m=105056155702138&w=2

 

Needless to say, it had occurred to me to create a project A-Test, and have B 
depend on both A and A-Test. However, as the respondent in the message at the 
link above states, this is problematic for the reason that now, either there 
are circular dependencies between A-Test and A, or A contains no tests 
(allowing naïve developers to do "m2 clean:clean test" and have things appear 
to be OK, then check in a bunch of broken code). Said respondent also states 
that maven1 requires special hackery to produce multiple artifacts and 
additionally that multiple artifacts per project are not encouraged.

 

This seems to me to be a design flaw in maven, which hopefully wouldn't be 
repeated in maven2.

 

By default, maven produces an artifact containing the contents of src/main. It 
seems odd that you cannot easily produce an artifact for src/*, or at the very 
least for src/test - since it's already handled magically by the test-plugin - 
and be able to specify dependencies on both A{artifact} and A{test-artifact} in 
related projects.

 

So my question is, a) is there an easy way to do this that I've just missed and 
if not b) do other people agree that this would be highly desirable (something 
like <artifact /> <testArtifactId />, and c) if b, is someone else going to add 
it, or do I have to ;-) ?

 

Thanks,

Dave

Reply via email to