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 Jackman <Da...@fastsearch.com> on 2005/10/27 00:22:34 UTC
[m2] Mojo paremeters using setters
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.
..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!");
}
}
Re: [m2] Mojo paremeters using setters
Posted by Jason van Zyl <ja...@maven.org>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] doc error for assembly plugin
Posted by Brett Porter <br...@gmail.com>.
The docs. It should be just descriptorId
On 10/28/05, Michael Heuer <he...@acm.org> wrote:
> Hello,
>
> Running the assembly plugin as documented on
>
> > http://maven.apache.org/plugins/maven-assembly-plugin/howto.html
>
> results in an error,
>
> $ mvn assembly:assembly -Dmaven.assembly.descriptorId=jar-with-dependencies
>
> [ERROR] BUILD FAILURE
> [INFO] -----------------------------------------------------------------
> [INFO] You must specify descriptor or descriptorId
>
>
> but if one uses an unqualified descriptorId property value
>
> $ mvn assembly:assembly -DdescriptorId=jar-with-dependencies
>
> [INFO] [assembly:assembly]
> [INFO] Building jar: .../myproject-SNAPSHOT-jar-with-dependencies.jar
> [INFO] -----------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] -----------------------------------------------------------------
>
> it seems to work fine. Is this an error with the assembly plugin or with
> the docs?
>
> michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] manifest for assembly jar-with-dependencies
Posted by Michael Heuer <he...@acm.org>.
> http://jira.codehaus.org/browse/MNG-1380
On Mon, 31 Oct 2005, Brett Porter wrote:
> Yes, that's an issue with the assembly plugin. If there is no
> corresponding JIRA issue, please file one.
>
> - Brett
>
> On 10/28/05, Michael Heuer <he...@acm.org> wrote:
> > Hello,
> >
> > I followed the guide at
> >
> > > http://maven.apache.org/guides/mini/guide-manifest.html
> >
> > to add entries to my MANIFEST.MF, and that works fine with
> >
> > $ mvn package
> >
> > However, it seems that the assembly plugin does not reuse the
> > configuration information when building the jar-with-dependencies jar, so
> > I'm left with a default manifest in that jar.
> >
> > michael
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] manifest for assembly jar-with-dependencies
Posted by Brett Porter <br...@gmail.com>.
Yes, that's an issue with the assembly plugin. If there is no
corresponding JIRA issue, please file one.
- Brett
On 10/28/05, Michael Heuer <he...@acm.org> wrote:
> Hello,
>
> I followed the guide at
>
> > http://maven.apache.org/guides/mini/guide-manifest.html
>
> to add entries to my MANIFEST.MF, and that works fine with
>
> $ mvn package
>
> However, it seems that the assembly plugin does not reuse the
> configuration information when building the jar-with-dependencies jar, so
> I'm left with a default manifest in that jar.
>
> michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
[m2] manifest for assembly jar-with-dependencies
Posted by Michael Heuer <he...@acm.org>.
Hello,
I followed the guide at
> http://maven.apache.org/guides/mini/guide-manifest.html
to add entries to my MANIFEST.MF, and that works fine with
$ mvn package
However, it seems that the assembly plugin does not reuse the
configuration information when building the jar-with-dependencies jar, so
I'm left with a default manifest in that jar.
michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
[m2] doc error for assembly plugin
Posted by Michael Heuer <he...@acm.org>.
Hello,
Running the assembly plugin as documented on
> http://maven.apache.org/plugins/maven-assembly-plugin/howto.html
results in an error,
$ mvn assembly:assembly -Dmaven.assembly.descriptorId=jar-with-dependencies
[ERROR] BUILD FAILURE
[INFO] -----------------------------------------------------------------
[INFO] You must specify descriptor or descriptorId
but if one uses an unqualified descriptorId property value
$ mvn assembly:assembly -DdescriptorId=jar-with-dependencies
[INFO] [assembly:assembly]
[INFO] Building jar: .../myproject-SNAPSHOT-jar-with-dependencies.jar
[INFO] -----------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -----------------------------------------------------------------
it seems to work fine. Is this an error with the assembly plugin or with
the docs?
michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org