You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Petar Tahchiev <pa...@gmail.com> on 2007/01/30 08:15:59 UTC

Is it possible to start a maven2 process in your code.

Hi guys,

Is there a way to instantiate a maven project process in the in my java
program? I mean is it possible to do something like this:



public static void main(String[] args) {

     MavenProject mavenProject = new MavenProject(new Model());

     ProjectExecutor executor = new ProjectExecutor();

     executor.execute(mavenProject); //this is supposed to start in a
separate thread.
}


Of course I know there's no such thing as the ProjectExecutor, what I am
asking is - what is the way to execute a MavenProject object in
my code?

Thank you.




-- 
Regards, Petar!
Karlovo, Bulgaria.

Re: Is it possible to start a maven2 process in your code.

Posted by Petar Tahchiev <pa...@gmail.com>.
On 30/01/07, Milos Kleint <mk...@gmail.com> wrote:
>
> google for maven embedder.
>
> Milos
>
> On 1/30/07, Petar Tahchiev <pa...@gmail.com> wrote:
> > Hi guys,
> >
> > Is there a way to instantiate a maven project process in the in my java
> > program? I mean is it possible to do something like this:
> >
> >
> >
> > public static void main(String[] args) {
> >
> >      MavenProject mavenProject = new MavenProject(new Model());
> >
> >      ProjectExecutor executor = new ProjectExecutor();
> >
> >      executor.execute(mavenProject); //this is supposed to start in a
> > separate thread.
> > }
> >
> >
> > Of course I know there's no such thing as the ProjectExecutor, what I am
> > asking is - what is the way to execute a MavenProject object in
> > my code?
> >
> > Thank you.
> >
> >
> >
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Thenk you gyus. I think this is what I am looking for:

http://maven.apache.org/guides/mini/guide-embedding-m2.html

Also I will try with the plexus classloader.

-- 
Regards, Petar!
Karlovo, Bulgaria.

Re: Is it possible to start a maven2 process in your code.

Posted by Milos Kleint <mk...@gmail.com>.
google for maven embedder.

Milos

On 1/30/07, Petar Tahchiev <pa...@gmail.com> wrote:
> Hi guys,
>
> Is there a way to instantiate a maven project process in the in my java
> program? I mean is it possible to do something like this:
>
>
>
> public static void main(String[] args) {
>
>      MavenProject mavenProject = new MavenProject(new Model());
>
>      ProjectExecutor executor = new ProjectExecutor();
>
>      executor.execute(mavenProject); //this is supposed to start in a
> separate thread.
> }
>
>
> Of course I know there's no such thing as the ProjectExecutor, what I am
> asking is - what is the way to execute a MavenProject object in
> my code?
>
> Thank you.
>
>
>
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
>
>

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


RE: Is it possible to start a maven2 process in your code.

Posted by je...@accenture.com.
Hi Petar,

You can always run a cmd command from in your java code.

	-> Runtime.getRuntim().exec(String[] cmdarray);

So your cmdarray could contain:
Index 0: mvn
Index 1: archetype:create
Index 2: -DgroupId=blabla
Index 3: -DartifactId=bla

I guess it works like that.
Haven't tried it myself, but you can give it a try.

Good luck !

Jelle


-----Original Message-----
From: Petar Tahchiev [mailto:paranoiabla@gmail.com] 
Sent: dinsdag 30 januari 2007 8:16
To: Maven Users List
Subject: Is it possible to start a maven2 process in your code.

Hi guys,

Is there a way to instantiate a maven project process in the in my java
program? I mean is it possible to do something like this:



public static void main(String[] args) {

     MavenProject mavenProject = new MavenProject(new Model());

     ProjectExecutor executor = new ProjectExecutor();

     executor.execute(mavenProject); //this is supposed to start in a
separate thread.
}


Of course I know there's no such thing as the ProjectExecutor, what I am
asking is - what is the way to execute a MavenProject object in
my code?

Thank you.




-- 
Regards, Petar!
Karlovo, Bulgaria.


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

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