You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by shruthiarjun <sh...@gmail.com> on 2012/02/13 04:46:10 UTC

Calling Maven from Java

Hello,
I need to invoke Maven goals from a Java program. Little bit of research has
given me a few ideas but I am unable to conclude on the approach. I am
hoping that someone out there can help me choose the right approach with
some inputs based on their experience:

1. Spawning a new process (exec(...)) and invoking the Maven commands like
'mvn install'
2. Using the Maven Embedder (is there no support for this now?)
3. Using Maven invoker plug - in (is this very limited in it's features?)


Any help shall be greatly appreciated

Thanks
Shruthi

--
View this message in context: http://maven.40175.n5.nabble.com/Calling-Maven-from-Java-tp5478139p5478139.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Calling Maven from Java

Posted by Gaurav Arora <g....@iontrading.com>.
We needed to do something similar a while back. The solution we came up was
to use groovy and AntBuilder (
http://groovy.codehaus.org/Using+Ant+from+Groovy). Not that you can't do it
with java but it'll just be too verbose and hard to maintain.

If nothing else invoking "mvn install" from AntBuilder is easy as cake.

On Mon, Feb 13, 2012 at 18:27, Karl Heinz Marbaise <kh...@gmx.de>wrote:

> Hi,
>
>
>  I am looking to do something similar. I want to deploy maven to a web
>> server
>> where I can remotely run commands like mn install to deploy jars from our
>> local repository for multiple applications without having to deploy
>> multiple
>> war files.
>>
> Do you need to deploy the artifacts only ? like war's, jar's etc. ?
> Than you should take a look into Aether Library which can help you...so
> you don't need a full fledged Maven for this...
>
> https://docs.sonatype.org/**display/AETHER/Home<https://docs.sonatype.org/display/AETHER/Home>
>
> Kind regards
> Karl Heinz Marbaise
> --
> SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
> Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
> Hauptstrasse 177                         USt.IdNr: DE191347579
> 52146 Würselen                           http://www.soebes.de
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Calling Maven from Java

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

> I am looking to do something similar. I want to deploy maven to a web server
> where I can remotely run commands like mn install to deploy jars from our
> local repository for multiple applications without having to deploy multiple
> war files.
Do you need to deploy the artifacts only ? like war's, jar's etc. ?
Than you should take a look into Aether Library which can help you...so 
you don't need a full fledged Maven for this...

https://docs.sonatype.org/display/AETHER/Home

Kind regards
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de

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


Re: Calling Maven from Java

Posted by MikeOliverAZ <mo...@corenttech.com>.
I am looking to do something similar. I want to deploy maven to a web server
where I can remotely run commands like mn install to deploy jars from our
local repository for multiple applications without having to deploy multiple
war files. 

Perhaps we can collaborate on he solution. 

Ollie

--
View this message in context: http://maven.40175.n5.nabble.com/Calling-Maven-from-Java-tp5478139p5478186.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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