On 4/12/07, Goel, Deepak <[EMAIL PROTECTED]> wrote:
How can I reuse existing plug-in code in writing my own plug-in? For
example, I wanted to reuse the existing install plug-in and tried to
extend my plug-in from InstallMojo. Since source code of InstallMojo
wasn't present, the generated plugin.xml didn't contain the proper
dependencies. So when I tried to call a method in base class
(InstallMojo), I got a NullPointerException as the properties it needs
weren't injected.

I am not sure that it is possible to reuse plugins that way.

The plexus friendly code that wires the maven/POM information into the
various properties doesn't seem to be reusable.

I usualy solve that by making the mojo to allow you to reuse the
reusable part. E.g. by adding setters:

E.g. 
http://svn.codehaus.org/mojo/trunk/mojo/keytool-maven-plugin/src/main/java/org/codehaus/mojo/keytool/GenkeyMojo.java

Look at the bottom: these setters are not really required for plexus,
but I use them for tests and to reuse the mojo into another plugin.

If there's a better way, I am all ears.

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to