0

I'm trying to port the functionality of a linux shell script to a Windows ant build.xml. In the linux script, I'm stuck on this line, where $* is a list of files (*.txt):

java -classpath $myClasspath com.myProgram.Main /destinationDirectory $*

So now, in ant, I am passing the space separated list of file names, but the ant java task thinks this is just a single file name so it chokes. Is there a way to pass in *.txt so I don't have to list out each file name in a separate nested element? Any ideas? Thanks.

yellavon
  • 2,821
  • 12
  • 52
  • 66

1 Answers1

1

This question was very helpful:

Using it I was able to create this ant java task:

<path id="myFiles">
  <fileset dir="src" includes="*.txt" />
</path>

<!-- convert fileset into a single property that is a space separated list of the file paths-->
<pathconvert pathsep=" " property="myFilesPathConverted" refid="myFiles" />

<java classname="com.myProgram.Main">
  <classpath refid="classpath"/>
  <arg value="${outputDirectory}" />
  <arg line="${myFilesPathConverted}" />
</java> 
Community
  • 1
  • 1
yellavon
  • 2,821
  • 12
  • 52
  • 66