You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mykel Alvis <my...@weirdness.com> on 2007/08/13 23:41:29 UTC

Outbound values from a mojo?

What's the mechanism for setting properties from inside a plugin?
I have a plugin that collects some information about the local environment
and I want to include those values in the manifest during packaging without
building my own manifest file.
Is this possible?
Thanks,
Myke

Re: Outbound values from a mojo?

Posted by Mykel Alvis <my...@weirdness.com>.
Works swimmingly. Thanks, Wayne!

On 8/13/07, Wayne Fay <wa...@gmail.com> wrote:
>
> Something along these lines should do it...
>
> import org.apache.maven.project.MavenProject;
>
>    /**
>     * The maven project.
>     *
>     * @parameter expression="${project}"
>     * @required
>     * @readonly
>     */
>    private MavenProject project;
>
> public void execute() throws MojoExecutionException,
> MojoFailureException
> {
>                project.getProperties().put("yourKey", "yourValue");
> }
>
> Wayne
>
> On 8/13/07, Mykel Alvis <my...@weirdness.com> wrote:
> > What's the mechanism for setting properties from inside a plugin?
> > I have a plugin that collects some information about the local
> environment
> > and I want to include those values in the manifest during packaging
> without
> > building my own manifest file.
> > Is this possible?
> > Thanks,
> > Myke
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
"My friends tell me I have an intimacy problem. But they don't really know
me." -- Garry Shandling
Anyone who has the power to make you believe absurdities has the power to
make you commit injustices. -- Voltaire

Re: Outbound values from a mojo?

Posted by Wayne Fay <wa...@gmail.com>.
Something along these lines should do it...

import org.apache.maven.project.MavenProject;

   /**
    * The maven project.
    *
    * @parameter expression="${project}"
    * @required
    * @readonly
    */
   private MavenProject project;

public void execute() throws MojoExecutionException,
MojoFailureException
{
               project.getProperties().put("yourKey", "yourValue");
}

Wayne

On 8/13/07, Mykel Alvis <my...@weirdness.com> wrote:
> What's the mechanism for setting properties from inside a plugin?
> I have a plugin that collects some information about the local environment
> and I want to include those values in the manifest during packaging without
> building my own manifest file.
> Is this possible?
> Thanks,
> Myke
>

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