You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Trevor Harmon <tr...@vocaro.com> on 2008/10/02 20:21:12 UTC
Launching more than one program
In Ant, I am used to launching programs like this:
<target name="foo">
<java classname="foo.Foo">
<arg value="-abc"/>
</java>
</target>
<target name="bar">
<java classname="bar.Bar">
<arg value="-xyz"/>
</java>
</target>
ant foo --> launches Foo with parameter -abc
ant bar --> launches Bar with parameter -xyz
This doesn't seem to be possible in Maven. The problem, apparently, is
that the exec:java goal maps to one and only one program. In other
words, all I can do is this:
mvn exec:java
I can set it up to launch Foo or Bar, but it can't handle both.
Is there a way around this?
Trevor
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Launching more than one program
Posted by Andrew Robinson <an...@gmail.com>.
configure 2 executions of the maven-exec-plugin, one for each of you
classes. Instead of using plugin/configuration use
plugin/executions/execution/configuration to setup the settings.
-Andrew
On Thu, Oct 2, 2008 at 12:21 PM, Trevor Harmon <tr...@vocaro.com> wrote:
> In Ant, I am used to launching programs like this:
>
> <target name="foo">
> <java classname="foo.Foo">
> <arg value="-abc"/>
> </java>
> </target>
>
> <target name="bar">
> <java classname="bar.Bar">
> <arg value="-xyz"/>
> </java>
> </target>
>
> ant foo --> launches Foo with parameter -abc
> ant bar --> launches Bar with parameter -xyz
>
> This doesn't seem to be possible in Maven. The problem, apparently, is that
> the exec:java goal maps to one and only one program. In other words, all I
> can do is this:
>
> mvn exec:java
>
> I can set it up to launch Foo or Bar, but it can't handle both.
>
> Is there a way around this?
>
> Trevor
>
>
> ---------------------------------------------------------------------
> 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: Launching more than one program
Posted by Trevor Harmon <tr...@vocaro.com>.
On Oct 2, 2008, at 3:58 PM, Wayne Fay wrote:
> But why are you needing to do this in the first place? Describe things
> in more detail and perhaps someone will have a better recommendation.
I'm not trying to do anything special. I just want to run a Java
program with different parameters. Sometimes I need to run two
different Java programs for one project.
If you want a specific example, here's one:
http://volta.svn.sourceforge.net/viewvc/volta/cascade/build.xml?&view=markup
In this Ant script, Java is invoked in different ways depending on
which target is specified.
ant quick-test
--> runs the main application with some simple test parameters
ant profile
--> runs a custom profiler program to test the performance of the
application
I simply want to do the same thing in Maven.
> Profiles can solve your problem.
Thanks for the pointer; I think that will work.
>
Trevor
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Launching more than one program
Posted by Trevor Harmon <tr...@vocaro.com>.
As a follow-up to this thread, I found a perfect example of the use
case I'm talking about, and it's in the Maven book itself. Take a look
at the end of section 7.9:
http://www.sonatype.com/book/reference/multimodule-web-spring.html#d0e8066
Here, the author is launching a command-line program in two different
ways, one with a "history" parameter and one without.
Now here's the really interesting thing: The author is not using the
exec plugin to do this! It's beyond my comprehension. Why would he
prefer typing out that huge command, rather than setting up a reusable
exec command in the POM? It all but confirms my suspicion that the
exec plugin is too limited to be useful, considering that Sonatype
themselves don't even bother using it.
Trevor
On Oct 2, 2008, at 3:58 PM, Wayne Fay wrote:
> Profiles can solve your problem.
>
> But why are you needing to do this in the first place? Describe things
> in more detail and perhaps someone will have a better recommendation.
>
> Wayne
>
> On Thu, Oct 2, 2008 at 11:21 AM, Trevor Harmon <tr...@vocaro.com>
> wrote:
>> In Ant, I am used to launching programs like this:
>>
>> <target name="foo">
>> <java classname="foo.Foo">
>> <arg value="-abc"/>
>> </java>
>> </target>
>>
>> <target name="bar">
>> <java classname="bar.Bar">
>> <arg value="-xyz"/>
>> </java>
>> </target>
>>
>> ant foo --> launches Foo with parameter -abc
>> ant bar --> launches Bar with parameter -xyz
>>
>> This doesn't seem to be possible in Maven. The problem, apparently,
>> is that
>> the exec:java goal maps to one and only one program. In other
>> words, all I
>> can do is this:
>>
>> mvn exec:java
>>
>> I can set it up to launch Foo or Bar, but it can't handle both.
>>
>> Is there a way around this?
>>
>> Trevor
>>
>>
>> ---------------------------------------------------------------------
>> 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: Launching more than one program
Posted by Wayne Fay <wa...@gmail.com>.
Profiles can solve your problem.
But why are you needing to do this in the first place? Describe things
in more detail and perhaps someone will have a better recommendation.
Wayne
On Thu, Oct 2, 2008 at 11:21 AM, Trevor Harmon <tr...@vocaro.com> wrote:
> In Ant, I am used to launching programs like this:
>
> <target name="foo">
> <java classname="foo.Foo">
> <arg value="-abc"/>
> </java>
> </target>
>
> <target name="bar">
> <java classname="bar.Bar">
> <arg value="-xyz"/>
> </java>
> </target>
>
> ant foo --> launches Foo with parameter -abc
> ant bar --> launches Bar with parameter -xyz
>
> This doesn't seem to be possible in Maven. The problem, apparently, is that
> the exec:java goal maps to one and only one program. In other words, all I
> can do is this:
>
> mvn exec:java
>
> I can set it up to launch Foo or Bar, but it can't handle both.
>
> Is there a way around this?
>
> Trevor
>
>
> ---------------------------------------------------------------------
> 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