You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adrian Zaharie <ad...@parasoft.com> on 2005/10/12 21:43:00 UTC

run executable with args from maven.xml

I'm trying to run an executable (windows, script on linux) via maven.xml; 
program needs to take command line arguments;

I'm looking for an example on how to do this; could not find anything in 
any docs, or examples except on calling built in functionality, or classes;

could anyone send me an example or pointer to an example doing this

here is what I need to do in my program
1. set some variables, and to program to execute
2. run the program

thank you

Adrian 


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


Re: run executable with args from maven.xml

Posted by Andy Glick <an...@acm.org>.
At 03:43 PM 10/12/2005, Adrian wrote:
>I'm trying to run an executable (windows, script on linux) via maven.xml; 
>program needs to take command line arguments;
>
>I'm looking for an example on how to do this; could not find anything in 
>any docs, or examples except on calling built in functionality, or classes;
>
>could anyone send me an example or pointer to an example doing this
>
>here is what I need to do in my program
>1. set some variables, and to program to execute
>2. run the program

Here is an example using a number of Ant tasks to set up and environment 
for executing the Ant java task. It turns out the the Maven  Jeez tags map 
the ant tags into the default Maven name space, which is why I didn't 
prefix the Ant tags with the Ant namespace.

To execute a program other than Java you can use the Ant exec task.

Hope that this helps.

   <goal name="jester">
     <delete dir="target/jester-src"/>
     <copy todir="target/jester-src">
       <fileset dir="src/java">
         <include name="**/*.java"/>
       </fileset>
     </copy>
     <pathconvert targetos="windows" property="classpath" 
refid="jester.classpath"/>
     <java classpathref="jester.classpath" classname="jester.TestTester" 
fork="true">
       <arg value="-cp=target/jester-src;${classpath}"/>
       <arg value="org.jvalue.value.name.PersonNameTest"/>
       <arg value="target/jester-src"/>
     </java>
   </goal> 


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


RE: run executable with args from maven.xml

Posted by Adrian Zaharie <ad...@parasoft.com>.
Hi Arnaud, thanks for your quick response

what I want is similar to running, let's say echo.exe (windows) with one or 
more args directly from within maven.xml
why? supposedly building directly from maven has extra info about the maven 
project tested, then running it from ant
however, I called my ant build script from maven.xml, and it run succesfully
program I want to run, is build on eclipse frame work, where I installed 
the maven plugin

here is an example of what I would like to run:
C:\>echo.exe %HOME% %TMP%

In my case, I would also need to be able to specify the location to where 
the executable is located, where my test directory is, etc...
I'm sure it's all the same

questions:
is there anything lost by calling the ant build script from maven.xml?  //I 
believe not
is it possible to call an exe file directly from a maven.xml file, or does 
an ant build file need to be used? //so far this seems to be the case

so in my case, all I care is to run the goal from maven; running the 
program will write a report for later examination; no conditions need to be 
evaluated

thanks
Adrian

At 10/12/2005 12:57 PM, Arnaud HERITIER wrote:
>Hi Adrian.
>
>Are you searching something like :
>
>     <exec dir="." executable="${maven.ssh.executable}" failonerror="true">
>       <arg line="${maven.ssh.args} -l ${siteUsername} ${siteAddress} 'cd 
> ${maven.homepage} &amp;&amp;
>${maven.site.gunzip.executable} ${maven.final.name}-site.tar.gz &amp;&amp; 
>${maven.site.tar.executable} ${maven.site.tar.options}
>${maven.final.name}-site.tar &amp;&amp; chmod ${maven.site.chmod.options} 
>${maven.site.chmod.mode} * . &amp;&amp; rm
>${maven.final.name}-site.tar'"/>
>     </exec>
>
>You can take a look at the exec task in ant.
>
>Arnaud
>
>
> > -----Message d'origine-----
> > De : Adrian Zaharie [mailto:adi@parasoft.com]
> > Envoyé : mercredi 12 octobre 2005 21:43
> > À : users@maven.apache.org; dev@maven.apache.org
> > Objet : run executable with args from maven.xml
> >
> > I'm trying to run an executable (windows, script on linux)
> > via maven.xml; program needs to take command line arguments;
> >
> > I'm looking for an example on how to do this; could not find
> > anything in any docs, or examples except on calling built in
> > functionality, or classes;
> >
> > could anyone send me an example or pointer to an example doing this
> >
> > here is what I need to do in my program
> > 1. set some variables, and to program to execute 2. run the program
> >
> > thank you
> >
> > Adrian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For
> > additional commands, e-mail: dev-help@maven.apache.org
> >
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org



Regards,

Adrian Zaharie
ParaSoft Corporation
(888) 305-0041 x 1229 


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


RE: run executable with args from maven.xml

Posted by Arnaud HERITIER <ah...@gmail.com>.
Hi Adrian.

Are you searching something like :

    <exec dir="." executable="${maven.ssh.executable}" failonerror="true">
      <arg line="${maven.ssh.args} -l ${siteUsername} ${siteAddress} 'cd ${maven.homepage} &amp;&amp;
${maven.site.gunzip.executable} ${maven.final.name}-site.tar.gz &amp;&amp; ${maven.site.tar.executable} ${maven.site.tar.options}
${maven.final.name}-site.tar &amp;&amp; chmod ${maven.site.chmod.options} ${maven.site.chmod.mode} * . &amp;&amp; rm
${maven.final.name}-site.tar'"/>
    </exec>

You can take a look at the exec task in ant.

Arnaud
 

> -----Message d'origine-----
> De : Adrian Zaharie [mailto:adi@parasoft.com] 
> Envoyé : mercredi 12 octobre 2005 21:43
> À : users@maven.apache.org; dev@maven.apache.org
> Objet : run executable with args from maven.xml
> 
> I'm trying to run an executable (windows, script on linux) 
> via maven.xml; program needs to take command line arguments;
> 
> I'm looking for an example on how to do this; could not find 
> anything in any docs, or examples except on calling built in 
> functionality, or classes;
> 
> could anyone send me an example or pointer to an example doing this
> 
> here is what I need to do in my program
> 1. set some variables, and to program to execute 2. run the program
> 
> thank you
> 
> Adrian 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For 
> additional commands, e-mail: dev-help@maven.apache.org
> 




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