John, I appreciate your thoughful and reasonable responses to
questions/issues like this. I have to second Ashley on this one. Please
try not to take the following personally, but consider it one person's
bad experience w/ trying to use m2 to do what seems like a simple
thing...
I really like being able to do "m2 clean:clean compile test install."
However, I don't like having no ability to reuse test code from one
project in another project which depends on it. Example: project A has
interface Blah and interface BlahDAO to persist blahs. I have
AbstractBlahDAOTest which has testXXX methods which test *interface
invariant* conditions of BlahDAO. Project B has a new subclass of Blah
and BlahDAO, but it's ProjectBBlahDAO *must* still abide by the
interface invariant constraints. So I want to have ProjectBBlahDAOTest
which extends AbstractBlahDAOTest from project A, but I can't because I
can't generate another (test) artifact in maven.
So, I spent between 3 days and a week reading the source and the (mostly
absent) documentation for plugin development, and developed
maven-test-artfiact plugin. Finally got it to generate the
${artifactId}-test.jar AND install it, but it turns out surefire won't
run tests where some of the testXXX methods are in an abstract base
class in another jar, apparently (even though it loads the class).
To which I have to say: why the hell did someone develop surefire in the
first place? There's already a perfectly good Ant junit task? And why
their own microcontainer? What the heck was wrong w/ Spring (which lots
of people already use).
It seems to me to be a codehaus thing: a propensity to eschew reuse of
other people's code.
So, the upshot is, my plugin doesn't work. It wouldn't work outside of
m2 anyway (since m2 plugins don't rely on normal Java mechanisms -- like
setter injection, to set their properties) so it's not really general as
I've heard claimed by some here as an argument why maven plugins are
good - loosely coupled to maven. And to make it work, I might have to
hack surefire. And plexus. And whatever other 20 wheels have been
reinvented rather than reused.
I realise that some of the above may be perceived as somewhat
inflammatory, but it's really just born out of the frustration of seeing
what seems like it should be an easy task -- one which I *can't imagine*
I'm the only one requiring -- be so difficult.
And since I don't really have more time to steal from my project to
devote to the maven plugin development task, I'm left looking for
alternatives, or reluctantly planning to rewrite the build process in
Ant buildfiles in the not too distant future.
Respectfully but w/ frustration and confusion,
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]