Howdy.
We've moved from a makefile system (GNUmake on UNIX, NMAKE on Windows) to ant,
and on the whole we're happy with it. However, we have discovered an irritating
feature of the <exec> task.
If I call
<exec executable="perl">
<arg value="foo.pl" />
</exec>
then (I believe) ant passes "perl foo.pl" to the command line, and Windows knows
what to do with it. Even though I passed "perl" and not "perl.exe", it still
launches foo.pl correctly.
I had hoped the same would be true for a .bat file, that is, that I could get
ant to execute a file called "bar.bat" simply by invoking the following:
<exec executable="bar" />
This appears not to be the case. Even though typing "bar" at a command prompt
works, my task in ant fails, because Windows doesn't know what I mean by "bar".
Of course, "bar.bat" will work, but we are hoping to have a single build.xml
work for all platforms as much as possible. Using a call to "bar.bat" would
require splitting my target into separate, platform-specific targets, or (worse
yet) defining a ${BAR} property somewhere in a platform-specific way.
I understand that this problem likely exists due to the platform-specific nature
of the Java "Runtime.getRuntime().exec" method underlying the <exec> task. But
isn't it possible to modify the logic for the <exec> task to handle this, so
that if I pass "bar" as an attribute in the <exec> task, then ant passes the
"Right Thing" to the OS to execute it? Just wondering.
--dave