Something like this should do the trick

   @Parameter(defaultValue = "${mojoExecution.lifecyclePhase}")
   private String executionPhase;

other "magic" properties available to mojos are documented in [1]

[1] http://maven.apache.org/ref/3.1.1/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html

--
Regards,
Igor


On 12/21/2013, 3:52, Lennart Jörelid wrote:
Hello all,

How can a running Mojo query the Maven API (or some other API) to find out
which Maven Phase it has been invoked in? Something like ...

String currentPhase = getSomeMavenApiHelper().getCurrentPhase();

--
+==============================+
| Bästa hälsningar,
| [sw. "Best regards"]
|
| Lennart Jörelid
| EAI Architect & Integrator
|
| jGuru Europe AB
| Mölnlycke - Kista
|
| Email: l...@jguru.se
| URL:   www.jguru.se
| Phone
| (skype):    jgurueurope
| (intl):     +46 708 507 603
| (domestic): 0708 - 507 603
+==============================+


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

Reply via email to