linux - 将带有文件列表的 shell 脚本转换为 ant build.xml

标签 linux windows shell ant

我正在尝试将 linux shell 脚本的功能移植到 Windows ant build.xml。在 linux 脚本中,我停留在这一行,其中 $* 是文件列表 (*.txt):

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

所以现在,在 ant 中,我正在传递以空格分隔的文件名列表,但是 ant java 任务认为这只是一个文件名,所以它会阻塞。有没有办法传入 *.txt,这样我就不必在单独的嵌套元素中列出每个文件名?有任何想法吗?谢谢。

最佳答案

这个问题很有帮助:

使用它我能够创建这个 ant java 任务:

<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> 

关于linux - 将带有文件列表的 shell 脚本转换为 ant build.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14632301/

相关文章:

windows - 线程如何在 Windows 上的多个处理器上执行?

linux - Bash 有颜色、粗体和带下划线的字符。为什么不是斜体?

linux - Linux 中文件互斥吗?如何实现?

linux - 轻量级查询服务器

linux - scp复制所有没有目录的文件

windows - Tortoisehg 在使用 subrepos 时打开控制台窗口。我该如何阻止它?

c++ - 如何在c中使用IWbemContext的 "__ProviderArchitecture"标志?

python - 从 shell 脚本输出创建 json

linux - linux shell中 "-newer $file"命令的 "find"选项是如何工作的?

python - 使用 Cython 将 Python 编译为 C