Author |
Message
|
jefflowrey |
Posted: Mon Apr 04, 2005 2:38 pm Post subject: Ant question |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I need to run an external process from Ant.
I'm having some difficulties. I'm by no means an expert at writing Ant tasks - I figured this one would be simple.
The difficulty I'm having is that I need to specify an argument like "-file=" and then specify the file name.
But I need to do a loop over a directory, and run this task against certain files.
So I tried a varient of the apply/Exec on task, (from the docs for 1.6.x)
Code: |
<apply executable="somecommand" parallel="false">
<arg value="-file="/>
<srcfile/>
...
</apply> |
But that put a space before the value of <srcfile/>.
I've started writing a custom Ant task that will run my external program for a specific input file and output file. But there's got to be a simpler way.
Any Ant experts out there? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 06, 2005 9:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Anyone? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
malammik |
Posted: Wed Apr 06, 2005 10:39 am Post subject: |
|
|
 Partisan
Joined: 27 Jan 2005 Posts: 397 Location: Philadelphia, PA
|
Not sure if this helps at all.
<executable keep="true" failure="abort" stage="install" type="jar"
targetfile="$INSTALL_PATH/bin/ant-launcher.jar">
<args>
<arg value="-buildfile" />
<arg value="$INSTALL_PATH/bin/build.xml" />
<arg value="-propertyfile" />
<arg value="$INSTALL_PATH/bin/build.properties" />
<!-- Log ant install details here -->
<arg value="-logfile" />
<arg value="$INSTALL_PATH/bin/logs/apache-ant-1.6.2-bin.log" />
<!-- Ant task that we want to call -->
<arg value="apache-ant-1.6.2-bin" />
</args>
</executable> _________________ Mikhail Malamud
http://www.netflexity.com
http://groups.google.com/group/qflex |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 06, 2005 10:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I'm not sure if that helps either.
It looks like that will build arguments like "-buildfile $INSTALL_PATH/bin/build.xml", with a space between "-buildfile" and the next argument.
I need to have no spaces between "-file=" and the value of the source file. So, for instance, "-file=/tmp/myfile", not "-file= /tmp/myfile". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Ratan |
Posted: Wed Apr 06, 2005 12:12 pm Post subject: |
|
|
 Grand Master
Joined: 18 Jul 2002 Posts: 1245
|
I never wrote Ant scripts, so just a thought :
Cant you just do
<apply executable="somecommand.bat" parallel="false">
<srcfile/>
...
</apply>
somecommand.bat is a script containing the command
somecommand -file=$1 _________________ -Ratan |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 06, 2005 12:23 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Ratan wrote: |
somecommand.bat is a script containing the command |
Well...
Yeah.
It's a good idea. It will certainly solve the problem.
But there should be a way to do this *in* Ant. It would be really bothersome if there isn't.
I guess I'll go do some research...  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|