You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by hezjing <he...@gmail.com> on 2007/06/04 09:53:40 UTC

Ant's Java task in Maven?

Hi!

With Ant, we have Java task to execute a main Java class.

How can I do this with Maven?


-- 

Hez

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


Re: Ant's Java task in Maven?

Posted by Jo Vandermeeren <jo...@gmail.com>.
On 6/4/07, hezjing <he...@gmail.com> wrote:
>
> I want to excute a Java class, similar to Ant's Java task
> (http://ant.apache.org/manual/CoreTasks/java.html).
>

Then use the exec plugin I mentioned in the previous post:
http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html.
The project's runtime classpath will be used to execute your main class.

Re: Ant's Java task in Maven?

Posted by hezjing <he...@gmail.com>.
I want to excute a Java class, similar to Ant's Java task
(http://ant.apache.org/manual/CoreTasks/java.html).


On 6/4/07, Jo Vandermeeren <jo...@gmail.com> wrote:
> On 6/4/07, hezjing <he...@gmail.com> wrote:
> >
> > Hi Jo
> >
> > I hope I can do this the "Maven's way" without using the Antrun plugin.
>
>
> What exactly do you want to do?
>
> Any better idea?
> >
>
> If you just want to execute a main class, the maven-exec-plugin might be
> what you are looking for.
> It's on the codehaus:
> http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html
>
>
> Cheers
> Jo
>


-- 

Hez

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


Re: Ant's Java task in Maven?

Posted by Jo Vandermeeren <jo...@gmail.com>.
On 6/4/07, hezjing <he...@gmail.com> wrote:
>
> Hi Jo
>
> I hope I can do this the "Maven's way" without using the Antrun plugin.


What exactly do you want to do?

Any better idea?
>

If you just want to execute a main class, the maven-exec-plugin might be
what you are looking for.
It's on the codehaus:
http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html


Cheers
Jo

Re: Ant's Java task in Maven?

Posted by Markku Saarela <ma...@iki.fi>.
Use as many execution element within executions as you need(use 
different id's):

        <executions>
          <execution>
            <id>HelloWorld-exec-1</id>
          <execution>
          <execution>
            <id>HelloWorld-exec-2</id>
          <execution>
        </executions>
 
- markku

hezjing wrote:
> Thank you, Jo and Markku!
> It is working now...
>
> What about if I have mulitple main Java classes? With Ant, I used to
> have different tasks to execute different Java classes:
>
>   <task name="run-server">
>      <java classname="a.b.c.Server"/>
>   </task>
>
>   <task name="run-client">
>      <java classname="a.b.c.Client"/>
>   </task>
>
>
>
> On 6/4/07, Markku Saarela <ma...@kolumbus.fi> wrote:
>> Use Maven Exec Plugin http://mojo.codehaus.org/exec-maven-plugin/
>>
>> - markku
>>
>> hezjing wrote:
>> > Hi Jo
>> >
>> > I hope I can do this the "Maven's way" without using the Antrun 
>> plugin.
>> >
>> > Any better idea?
>> >
>> >
>> > On 6/4/07, Jo Vandermeeren <jo...@gmail.com> wrote:
>> >> You can call your Ant task with the maven-antrun-plugin:
>> >> http://maven.apache.org/plugins/maven-antrun-plugin/
>> >>
>> >> On 6/4/07, hezjing <he...@gmail.com> wrote:
>> >> >
>> >> > Hi!
>> >> >
>> >> > With Ant, we have Java task to execute a main Java class.
>> >> >
>> >> > How can I do this with Maven?
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> > Hez
>> >> >
>> >> > 
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> > For additional commands, e-mail: users-help@maven.apache.org
>> >> >
>> >> >
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>


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


Re: Ant's Java task in Maven?

Posted by hezjing <he...@gmail.com>.
Thank you, Jo and Markku!
It is working now...

What about if I have mulitple main Java classes? With Ant, I used to
have different tasks to execute different Java classes:

   <task name="run-server">
      <java classname="a.b.c.Server"/>
   </task>

   <task name="run-client">
      <java classname="a.b.c.Client"/>
   </task>



On 6/4/07, Markku Saarela <ma...@kolumbus.fi> wrote:
> Use Maven Exec Plugin http://mojo.codehaus.org/exec-maven-plugin/
>
> - markku
>
> hezjing wrote:
> > Hi Jo
> >
> > I hope I can do this the "Maven's way" without using the Antrun plugin.
> >
> > Any better idea?
> >
> >
> > On 6/4/07, Jo Vandermeeren <jo...@gmail.com> wrote:
> >> You can call your Ant task with the maven-antrun-plugin:
> >> http://maven.apache.org/plugins/maven-antrun-plugin/
> >>
> >> On 6/4/07, hezjing <he...@gmail.com> wrote:
> >> >
> >> > Hi!
> >> >
> >> > With Ant, we have Java task to execute a main Java class.
> >> >
> >> > How can I do this with Maven?
> >> >
> >> >
> >> > --
> >> >
> >> > Hez
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> >
> >> >
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 

Hez

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


Re: Ant's Java task in Maven?

Posted by Markku Saarela <ma...@kolumbus.fi>.
Use Maven Exec Plugin http://mojo.codehaus.org/exec-maven-plugin/

- markku

hezjing wrote:
> Hi Jo
>
> I hope I can do this the "Maven's way" without using the Antrun plugin.
>
> Any better idea?
>
>
> On 6/4/07, Jo Vandermeeren <jo...@gmail.com> wrote:
>> You can call your Ant task with the maven-antrun-plugin:
>> http://maven.apache.org/plugins/maven-antrun-plugin/
>>
>> On 6/4/07, hezjing <he...@gmail.com> wrote:
>> >
>> > Hi!
>> >
>> > With Ant, we have Java task to execute a main Java class.
>> >
>> > How can I do this with Maven?
>> >
>> >
>> > --
>> >
>> > Hez
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>>
>
>


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


Re: Ant's Java task in Maven?

Posted by hezjing <he...@gmail.com>.
Hi Jo

I hope I can do this the "Maven's way" without using the Antrun plugin.

Any better idea?


On 6/4/07, Jo Vandermeeren <jo...@gmail.com> wrote:
> You can call your Ant task with the maven-antrun-plugin:
> http://maven.apache.org/plugins/maven-antrun-plugin/
>
> On 6/4/07, hezjing <he...@gmail.com> wrote:
> >
> > Hi!
> >
> > With Ant, we have Java task to execute a main Java class.
> >
> > How can I do this with Maven?
> >
> >
> > --
> >
> > Hez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>


-- 

Hez

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


Re: Ant's Java task in Maven?

Posted by Jo Vandermeeren <jo...@gmail.com>.
You can call your Ant task with the maven-antrun-plugin:
http://maven.apache.org/plugins/maven-antrun-plugin/

On 6/4/07, hezjing <he...@gmail.com> wrote:
>
> Hi!
>
> With Ant, we have Java task to execute a main Java class.
>
> How can I do this with Maven?
>
>
> --
>
> Hez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>