You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Allison, Bob" <ro...@qwest.com> on 2005/10/06 11:48:12 UTC

Plugin Development Guide Questions

I am making a start at the Plugin Development Guide as I am working on
my first plugin.  You can find the current contents at
http://sd.no-ip.biz/maven2pdg/.  I welcome any comments, corrections,
and suggestions.  At this moment, I have a number of questions which I
have not been able to answer which I think probably ought to be answered
in the document:

What is the criteria for a mojo class?  In other words, when I define a
bunch of classes in a project with packaging of "maven-plugin", how is
it determined which of those classes are mojos and which are other
things?

What is the difference between MojoExecutionException and
MojoFailureException?  They have the same documentation but I assume
that they should be used for different types of problems.

When defining parameters to a mojo, I see that some mojos include a
setter for the parameter but a lot do not have any setter.  Is there
some criteria to be used to determine when a setter is needed or
desired?

What types of objects can be used as parameters?  I assume this has
something to do with what plexus can convert from XML content.

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


Re: Plugin Development Guide Questions

Posted by Arik Kfir <ar...@gmail.com>.
Just out of curiosity - why not have one exception class, with an *optional*
causing exception?

On 10/6/05, Brett Porter <br...@gmail.com> wrote:
>
> On 10/6/05, Allison, Bob <ro...@qwest.com> wrote:
> > What is the criteria for a mojo class? In other words, when I define a
> > bunch of classes in a project with packaging of "maven-plugin", how is
> > it determined which of those classes are mojos and which are other
> > things?
>
> I'd have said "implements Mojo" but apparently not :)
>
> for Java, it is any class with class level javadoc containing a @goal
> tag. See JavaMojoDescriptorExtractor.
>
> > What is the difference between MojoExecutionException and
> > MojoFailureException? They have the same documentation but I assume
> > that they should be used for different types of problems.
>
> Should result in a BUILD ERROR or BUILD FAILURE respectively. MEE has
> a causing exception, while the other is just a string. MEE should be
> the "unexpected" one, while MFE is more "expected" failures (like
> compilation errors).
>
> This is new and a lot of the plugins don't deal with it well.
>
> > When defining parameters to a mojo, I see that some mojos include a
> > setter for the parameter but a lot do not have any setter. Is there
> > some criteria to be used to determine when a setter is needed or
> > desired?
>
> If it is there, it is used. If not, private field injection is used.
>
> > What types of objects can be used as parameters? I assume this has
> > something to do with what plexus can convert from XML content.
>
>
> http://svn.plexus.codehaus.org/trunk/plexus-containers/plexus-container-default/src/main/java/org/codehaus/plexus/component/configurator/converters/
>
> - Brett
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Plugin Development Guide Questions

Posted by Brett Porter <br...@gmail.com>.
On 10/6/05, Allison, Bob <ro...@qwest.com> wrote:
> What is the criteria for a mojo class?  In other words, when I define a
> bunch of classes in a project with packaging of "maven-plugin", how is
> it determined which of those classes are mojos and which are other
> things?

I'd have said "implements Mojo" but apparently not :)

for Java, it is any class with class level javadoc containing a @goal
tag. See JavaMojoDescriptorExtractor.

> What is the difference between MojoExecutionException and
> MojoFailureException?  They have the same documentation but I assume
> that they should be used for different types of problems.

Should result in a BUILD ERROR or BUILD FAILURE respectively. MEE has
a causing exception, while the other is just a string. MEE should be
the "unexpected" one, while MFE is more "expected" failures (like
compilation errors).

This is new and a lot of the plugins don't deal with it well.

> When defining parameters to a mojo, I see that some mojos include a
> setter for the parameter but a lot do not have any setter.  Is there
> some criteria to be used to determine when a setter is needed or
> desired?

If it is there, it is used. If not, private field injection is used.

> What types of objects can be used as parameters?  I assume this has
> something to do with what plexus can convert from XML content.

http://svn.plexus.codehaus.org/trunk/plexus-containers/plexus-container-default/src/main/java/org/codehaus/plexus/component/configurator/converters/

- Brett

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