Running maven from inside JVM.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Running maven from inside JVM.

Som Lima
Hi,

Is it possible to run maven from inside JVM ?

i.e.

Java -jar maven.jar --pom:/home/project/pom.xml  --goals:clean install
package
Reply | Threaded
Open this post in threaded view
|

Re: Running maven from inside JVM.

Paul Hammant-3
Google for "embedding Maven". Articles like
https://techblog.bozho.net/embedding-maven/ talk about that.
Reply | Threaded
Open this post in threaded view
|

Re: Running maven from inside JVM.

Som Lima
In reply to this post by Som Lima
Thanks.
I think I am going to feel like a fool

If this works as I want it to.

import org.apache.maven.cli.MavenCli;
import java.io.File;
/**
* @author Mariusz Smykula
*/
public class MavenClient {
public static void main(String[] args) {
System.out.println(new File(".").getAbsolutePath());
MavenCli cli = new MavenCli();
cli.doMain(new String[]{"clean", "install"}, ".", System.out, System.out);
}
}

https://github.com/mariuszs/maven-cli-example/blob/master/src/main/java/MavenClient.java

On Sun, 28 Mar 2021, 09:05 Markus KARG, <[hidden email]> wrote:

> Yes, there is an API to embed Maven.
> -Markus
>
>
> -----Ursprüngliche Nachricht-----
> Von: Som Lima [mailto:[hidden email]]
> Gesendet: Sonntag, 28. März 2021 06:26
> An: [hidden email]
> Betreff: Running maven from inside JVM.
>
> Hi,
>
> Is it possible to run maven from inside JVM ?
>
> i.e.
>
> Java -jar maven.jar --pom:/home/project/pom.xml  --goals:clean install
> package
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>