You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Sag <ds...@epo.org> on 2005/10/12 12:00:22 UTC

[m2] writing a plug-in - a question on field names and descriptors

It is my normal practice when writing Java to declare instance fields 
starting with  the word 'the' - ie theHeight rather than just height.

However when configuring my plug-in i want the parameters to be called 
height, not 'theHeight'.

I tone on this page 
http://maven.apache.org/maven2/developers/mojo-api-specification.html that 
there is a descriptor element called 'alias' that 

Specifies an alias which can be used to configure this parameter from the 
POM. This is primarily useful to improve user-friendliness, where Mojo 
field names are not intuitive to the user or are otherwise not conducive 
to configuration via the POM.

but when I try to use this as follows:

    /**
     * The Chart height.
     * @parameter default-value=600
     * @parameter alias="height"
     */
    private int theHeight = DEFAULT_HEIGHT;

what ends up in my plugin.xml file is still

<parameter>
  <name>theHeight</name>
  <type>int</type>
  <required>false</required>
  <editable>true</editable>
  <description>The Chart height.</description>
</parameter>

Is this a bug?  If not then what is the purpose of the 'alias'?

Kind regards,
Dave Sag 




 

Re: [m2] writing a plug-in - a question on field names and descriptors

Posted by Brett Porter <br...@gmail.com>.
You can only give one @parameter tag, but with multiple attributes.

@parameter alias="height" default-value="600"

- Brett

On 10/12/05, David Sag <ds...@epo.org> wrote:
>
>
> It is my normal practice when writing Java to declare instance fields
> starting with the word 'the' - ie theHeight rather than just height.
>
> However when configuring my plug-in i want the parameters to be called
> height, not 'theHeight'.
>
> I tone on this page
> http://maven.apache.org/maven2/developers/mojo-api-specification.html that
> there is a descriptor element called 'alias' that
>
> Specifies an alias which can be used to configure this parameter from the
> POM. This is primarily useful to improve user-friendliness, where Mojo field
> names are not intuitive to the user or are otherwise not conducive to
> configuration via the POM.
>
> but when I try to use this as follows:
>
> /**
> * The Chart height.
> * @parameter default-value=600
> * @parameter alias="height"
> */
> private int theHeight = DEFAULT_HEIGHT;
>
> what ends up in my plugin.xml file is still
>
> <parameter>
> <name>theHeight</name>
> <type>int</type>
> <required>false</required>
> <editable>true</editable>
> <description>The Chart height.</description>
> </parameter>
>
> Is this a bug? If not then what is the purpose of the 'alias'?
>
> Kind regards,
> Dave Sag
>
>
>
>
>