Hi all,

I'm about to write my first Maven plugin which actually is just a
specialized version of the xml-maven-plugin. It's purpose is to transform a
special XML format to a Java source code file by using always the same
XSLT-File.
I could use the xml-maven-plugin directly but I want to ease the use of my
plugin as much as possible. Users shall not have to declare the XSLT-File to
use and there shall be reasonable presettings for the other configurations
parameters.

All functionality that my plugin shall have is already part of the
transform-Mojo of the xml-maven-plugin. So it seems to be a good idea to
reuse this Mojo in my plugin. But I wonder about the best way to accomplish
this reusage.

1. possibility:
I could declare a dependency on xml-maven-plugin, instantiate its
TransformMojo class and fill in all parameters that my special
transformation needs. Filling in the parameters has to be done via
reflection since the TransformMojo doesn't offer setter methods for this
purpose.

2. possibilty:
I could simply copy all Mojo code and that of classes it's depending on from
xml-maven-plugin into my plugin. This would only be a good idea if direct
Mojo reusage is a discouraged practice in Maven plugin development.

So, what's the best approach? Is there any form of "political correctness"
in plugin reusage that I should be aware of?

TIA.

Bye, Stefan

-- 
View this message in context: 
http://old.nabble.com/Plugin-Development%3A-Best-way-to-reuse-a-Mojo-from-another-plugin--tp28137687p28137687.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to