You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mike Perham <mp...@gmail.com> on 2006/09/11 17:15:10 UTC

subclassing a mojo in another plugin

Xdoclet plugin is subclassing a class in the Antrun plugin.  This
antrun class has an injected property that works when used as part of
an antrun execution but is null when xdoclet plugin is executed.
Should this work?

public abstract class AbstractAntMojo
    extends AbstractMojo
{

    /**
     * The plugin dependencies.
     *
     * @parameter expression="${plugin.artifacts}"
     * @required
     * @readonly
     */
    private List artifacts;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: subclassing a mojo in another plugin

Posted by Kenney Westerhof <ke...@apache.org>.
No, the plugin-plugin can only scan source files for the annotations and doesn't
re-use parent class info. You'll need to redefine that parameter if you want to
use it in the xdoclet plugin.

It would be neat to let the plugin-plugin scan the parent class' META-INF/maven/plugin.xml
and add those fields to the newly created plugin.xml. This is currently stopping plugins from
reusing other plugins (and hence is disapproved of..)

-- Kenney

Mike Perham wrote:
> Xdoclet plugin is subclassing a class in the Antrun plugin.  This
> antrun class has an injected property that works when used as part of
> an antrun execution but is null when xdoclet plugin is executed.
> Should this work?
> 
> public abstract class AbstractAntMojo
>    extends AbstractMojo
> {
> 
>    /**
>     * The plugin dependencies.
>     *
>     * @parameter expression="${plugin.artifacts}"
>     * @required
>     * @readonly
>     */
>    private List artifacts;
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org