On Wed, 2005-10-26 at 16:22 -0600, David Jackman wrote:
> According to
> http://maven.apache.org/guides/mini/guide-configuring-plugins.html (at
> the bottom), you can use setters for the Mojo parameters so your private
> field can use a different naming convention.  However, when I tried to
> do this, it didn't work.  Am I doing something wrong?  Here's my Mojo
> class.

That doco needs some correction ... it0064 is the test for setters and
it uses this:

http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-core-it-
plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java?rev=280076&view=markup

You need to tell plexus what property to use for read/write access as it
can't guess because the field name may be entirely different, like in
your case.

@parameter
  property="greeting"
 
Is what you would use in your case. Sorry for the confusion.

> ..David..
>  
> /**
>  * My example Mojo (taken from the Maven Guide to Developing Java
> Plugins).
>  * 
>  * @goal sayhi
>  * @description My hello world plugin.
>  */
> public class GreetingMojo extends AbstractMojo
> {
>     /**
>      * The greeting to display.
>      * @parameter expression="Hello"
>      */
>     private String m_greeting;
>     
>     
>     /**
>      * Sets the greeting.
>      * 
>      * @param greeting  the greeting to use.
>      */
>     public void setGreeting(String greeting)
>     {
>         m_greeting = greeting;
>     }
>     
>     
>     /**
>      * @see org.apache.maven.plugin.Mojo#execute()
>      */
>     public void execute() throws MojoExecutionException,
> MojoFailureException
>     {
>         getLog().info(m_greeting + ", world!");
>     }
> }
> 
-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

 -- Thoreau 


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

Reply via email to