Plugin to detect if called from the shell

2009-11-10 Thread Gajo Csaba

Hello,

Is there a way for a Maven plugin (Mojo) to detect if it has been called 
from the console, and not from pom.xml as part of the lifecycle? I have 
a Mojo which has @requiresProject false, and I execute it like mvn 
pluginname:dostuff


But it also can be called from pom.xml, as part of a lifecycle.

If it's called from the shell, I would like the user to input some 
parameters from the console.


Is there a way to detect how the plugin was called? It would obviously 
not make sense to ask the user anything during the build lifecycle, 
especially if it's being done by Continuum etc...


Thanks, Csaba



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



Re: Plugin to detect if called from the shell

2009-11-10 Thread Martin Höller
Hi!

Am Dienstag, 10. November 2009 16:58:48 schrieb Gajo Csaba:
 Is there a way for a Maven plugin (Mojo) to detect if it has been called
 from the console, and not from pom.xml as part of the lifecycle? I have
 a Mojo which has @requiresProject false, and I execute it like mvn
 pluginname:dostuff

 But it also can be called from pom.xml, as part of a lifecycle.

 If it's called from the shell, I would like the user to input some
 parameters from the console.

Have a look at the release-plugin [0]. If the --batch-mode parameter of maven 
is given, it doesn't ask the user for input but expects some variables to be 
defined.

hth,
- martin

[0] 
http://maven.apache.org/plugins/maven-release-plugin/examples/non-interactive-release.html


signature.asc
Description: This is a digitally signed message part.