Re: Dynamically determining the currently executing goal name

2012-09-11 Thread Jeff Maxwell
 This works fine:

/** The project. */
@Parameter(required = true, readonly = true, defaultValue =
"${mojoExecution}")
private MojoExecution mojoExecution;

@Override
public String getGoalName() {
return this.mojoExecution.getMojoDescriptor().getGoal();
}

It was a bit of effort to get it to work with AbstractMojoTestCase but
not too bad.

Thanks!



--
View this message in context: 
http://maven.40175.n5.nabble.com/Dynamically-determining-the-currently-executing-goal-name-tp5721050p5721312.html
Sent from the Maven Developers mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: Dynamically determining the currently executing goal name

2012-09-11 Thread Tamás Cservenák
Add following member to your Mojo and inspect what is injected:

/**
 * Mojo execution.
 *
 * @parameter default-value="${mojoExecution}"
 * @required
 * @readonly
 */
private org.apache.maven.plugin.MojoExecution mojoExecution;


Hope helps,
~t~

On Mon, Sep 10, 2012 at 6:59 PM, Jeff Maxwell wrote:

> I would like to dynamically determine the currently executing goal from a
> MOJO.
>
> I attempted this using reflection but the new annotations are not available
> at runtime.
>
> All other solutions I have seen appear to require access to the executing
> MOJO's groupId and artifactId.
>
> Anyone have a solution?
> Is there an issue with having the annotations available at runtime?
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Dynamically-determining-the-currently-executing-goal-name-tp5721050.html
> Sent from the Maven Developers mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>


Dynamically determining the currently executing goal name

2012-09-10 Thread Jeff Maxwell
I would like to dynamically determine the currently executing goal from a
MOJO.

I attempted this using reflection but the new annotations are not available
at runtime.

All other solutions I have seen appear to require access to the executing
MOJO's groupId and artifactId.

Anyone have a solution?
Is there an issue with having the annotations available at runtime?





 




--
View this message in context: 
http://maven.40175.n5.nabble.com/Dynamically-determining-the-currently-executing-goal-name-tp5721050.html
Sent from the Maven Developers mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org