You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Stevenson, Chris" <Ch...@DrKW.com> on 2005/10/24 17:24:40 UTC

[m2] Getting Command Line inside a Mojo

Dear All,
 
Does anyone know what is the best way to execute a native command in a mojo?
I've seen a couple of Mojo's using the CommandLine class in: 
 
org.apache.maven.it.cli

Is that the recommended method?
 
Thanks,
 
Chris
 

Chris Stevenson

Dresdner Kleinwort Wasserstein 

 ------


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender. 3166
--------------------------------------------------------------------------------


Re: [m2] Getting Command Line inside a Mojo

Posted by jerome lacoste <je...@gmail.com>.
On 10/24/05, Stevenson, Chris <Ch...@drkw.com> wrote:
> Dear All,
>
> Does anyone know what is the best way to execute a native command in a mojo?
> I've seen a couple of Mojo's using the CommandLine class in:
>
> org.apache.maven.it.cli
>
> Is that the recommended method?

I will add this to Brett's comment:
- if you just need to execute a command line and do not much more, you
can maybe use the exec or execute plugin (found in mojo-sandbox)
(http://mojo.codehaus.org)
- special case: if you need to execute a SDK command
($JAVA_HOME/bin/yourcommand), you migth want to look at the keytool
and javadoc plugins.
- I really hope commons-exec to become more usable and the preferred
way to run commands later one. Today it does most of what plexus cli
does. It will do a little bit more one day. Read the dev@commons
archive mailing list for more info. Once commons-dev is released, I
will at least retrofit it into all the plugins I wrote.

Cheers,

Jerome

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


Re: [m2] Getting Command Line inside a Mojo

Posted by Brett Porter <br...@gmail.com>.
This has been discussed a few times before. Yes, this is a reasonable
library for doing so, but has some limitations. You can also use
Runtime.exec (even more limitations), or help out with the pre-alpha
library jakarta commons-exec.

HTH,
Brett

On 10/24/05, Stevenson, Chris <Ch...@drkw.com> wrote:
> Dear All,
>
> Does anyone know what is the best way to execute a native command in a mojo?
> I've seen a couple of Mojo's using the CommandLine class in:
>
> org.apache.maven.it.cli
>
> Is that the recommended method?
>
> Thanks,
>
> Chris
>
>
> Chris Stevenson
>
> Dresdner Kleinwort Wasserstein
>
>  ------
>
>
> --------------------------------------------------------------------------------
> The information contained herein is confidential and is intended solely for the
> addressee. Access by any other party is unauthorised without the express
> written permission of the sender. If you are not the intended recipient, please
> contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
> via e-mail return. If you have received this e-mail in error or wish to read our
> e-mail disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender. 3166
> --------------------------------------------------------------------------------
>
>
>

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