On 15 June 2010 16:31, <giuseppe.gr...@b-source.ch> wrote:

> Finally I was able to compile it... but it does not work. I created a
> base class like this:
>
> public abstract class ContextAbstractMojo extends AbstractMojo {
>
>    /**
>     * The execution ID as defined in the POM.
>      *
>     * @parameter default-value="${mojoExecution}}"
>

you have a syntax error here, try using only one closing }


>     * @readonly
>     */
>     private MojoExecution execution;
>
>    /**
>     * The context ID as an alternative to the execution ID.
>     */
>    //private String context;
>
>    /**
>     * Gets the execution ID as defined in the POM.
>     *
>     * @return The execution ID.
>     */
>    protected String getExecutionID() {
>
>        String executionId = null;
>        if (execution != null) executionId = execution.getExecutionId();
>        return executionId
>   }
>
>    public abstract void execute() throws MojoExecutionException;
> }
>
> Then, when I try to execute the concrete mojo, I always get the
> following error message:
>
> Cause: Cannot assign configuration entry 'execution' to 'class
> org.apache.maven.plugin.MojoExecution' from 'null', which is of type
> class java.lang.String
>
> As far as I know this should work starting from Maven 2.0 (I'm using
> version 2.2). Any idea?
>
> Jeff
>
>
> > -----Original Message-----
> > From: Jason van Zyl [mailto:ja...@sonatype.com]
> > Sent: Tuesday, June 15, 2010 5:14 PM
> > To: Maven Developers List
> > Subject: Re: How to get the execution id from a plugin
> >
> >
> > Yes, I realize.
> >
> > Look at an existing plugin and start with that. Or use the
> > Maven Plugin archteype. If you don't know what I'm talking
> > about then read this:
> >
> > http://www.sonatype.com/products/maven/documentation/book-defguide
> >
> > On Jun 15, 2010, at 11:04 AM, <giuseppe.gr...@b-source.ch>
> > <giuseppe.gr...@b-source.ch> wrote:
> >
> > > Found... but version 2.6 does not contain class
> > MojoExecution and the
> > > code below does not compile.
> > >
> > >> -----Original Message-----
> > >> From: Jason van Zyl [mailto:ja...@sonatype.com]
> > >> Sent: Tuesday, June 15, 2010 4:51 PM
> > >> To: Maven Developers List
> > >> Subject: Re: How to get the execution id from a plugin
> > >>
> > >>
> > >> http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-p
> > >> lugin-plugin/
> > >>
> > >> On Jun 15, 2010, at 10:49 AM, <giuseppe.gr...@b-source.ch>
> > >> <giuseppe.gr...@b-source.ch> wrote:
> > >>
> > >>> ... it does not compile because the central repository does
> > >> not contain
> > >>> artifact maven-plugin-plugin :-(
> > >>>
> > >>> Jeff
> > >>>
> > >>>> -----Original Message-----
> > >>>> From: Benjamin Bentmann [mailto:benjamin.bentm...@udo.edu]
> > >>>> Sent: Tuesday, June 15, 2010 3:49 PM
> > >>>> To: Maven Developers List
> > >>>> Subject: Re: How to get the execution id from a plugin
> > >>>>
> > >>>>
> > >>>> Giuseppe.Greco wrote:
> > >>>>
> > >>>>>   private void execute() throws MojoExecutionException
> > >>>>>   {
> > >>>>>       /* I need to get the execution id here */
> > >>>>>   }
> > >>>>
> > >>>>  /**
> > >>>>   * @parameter default-value="${mojoExecution}"
> > >>>>   * @readonly
> > >>>>   */
> > >>>>  private MojoExecution mojoExecution;
> > >>>>
> > >>>> and
> > >>>>
> > >>>>  mojoExecution.getId();
> > >>>>
> > >>>> should do. I only can't tell since what Maven version that works.
> > >>>>
> > >>>>
> > >>>> Benjamin
> > >>>>
> > >>>>
> > >>
> > ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > >>>> For additional commands, e-mail: dev-h...@maven.apache.org
> > >>>>
> > >>>>
> > >>>
> > >>> IMPORTANT:
> > >>> This e-mail transmission is intended for the named
> > >>> addressee(s)only.
> > >>> Its contents are private, confidential and protected
> > >>> from disclosure and should not be read, copied or
> > >>> disclosed by any other person.
> > >>> If you are not the intended recipient, we kindly ask
> > >>> you to notify the sender immediately by telephone
> > >>> (+41 (0)58 806 50 00), to redirect the message to the
> > >>> account "i...@b-source.ch" and to delete this e-mail.
> > >>> E-mail transmissions may be intercepted, altered or
> > >>> read by unauthorized persons and may contain viruses.
> > >>> Therefore, it is recommended that you use regular mail
> > >>> or courier services for any information intended to be
> > >>> confidential. However, by sending us messages through
> > >>> e-mail, you authorize and instruct us to correspond by
> > >>> e-mail in the relevant matter.
> > >>> Thank you.
> > >>>
> > >>>
> > >>>
> > >>
> > ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > >>> For additional commands, e-mail: dev-h...@maven.apache.org
> > >>>
> > >>
> > >> Thanks,
> > >>
> > >> Jason
> > >>
> > >> ----------------------------------------------------------
> > >> Jason van Zyl
> > >> Founder,  Apache Maven
> > >> http://twitter.com/jvanzyl
> > >> ---------------------------------------------------------
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > > IMPORTANT:
> > > This e-mail transmission is intended for the named
> > > addressee(s)only.
> > > Its contents are private, confidential and protected
> > > from disclosure and should not be read, copied or
> > > disclosed by any other person.
> > > If you are not the intended recipient, we kindly ask
> > > you to notify the sender immediately by telephone
> > > (+41 (0)58 806 50 00), to redirect the message to the
> > > account "i...@b-source.ch" and to delete this e-mail.
> > > E-mail transmissions may be intercepted, altered or
> > > read by unauthorized persons and may contain viruses.
> > > Therefore, it is recommended that you use regular mail
> > > or courier services for any information intended to be
> > > confidential. However, by sending us messages through
> > > e-mail, you authorize and instruct us to correspond by
> > > e-mail in the relevant matter.
> > > Thank you.
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > > For additional commands, e-mail: dev-h...@maven.apache.org
> > >
> >
> > Thanks,
> >
> > Jason
> >
> > ----------------------------------------------------------
> > Jason van Zyl
> > Founder,  Apache Maven
> > http://twitter.com/jvanzyl
> > ---------------------------------------------------------
> >
> > A language that doesn't affect the way you think about
> > programming is not worth knowing.
> >
> >  -- Alan Perlis
> >
> >
> >
> >
>
> IMPORTANT:
> This e-mail transmission is intended for the named
> addressee(s)only.
> Its contents are private, confidential and protected
> from disclosure and should not be read, copied or
> disclosed by any other person.
> If you are not the intended recipient, we kindly ask
> you to notify the sender immediately by telephone
> (+41 (0)58 806 50 00), to redirect the message to the
> account "i...@b-source.ch" and to delete this e-mail.
> E-mail transmissions may be intercepted, altered or
> read by unauthorized persons and may contain viruses.
> Therefore, it is recommended that you use regular mail
> or courier services for any information intended to be
> confidential. However, by sending us messages through
> e-mail, you authorize and instruct us to correspond by
> e-mail in the relevant matter.
> Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>

Reply via email to