我正在尝试复制宏中的文件,如下所示:
<project name="why" default="go">
<macrodef name="copy-some-stuff">
<attribute name="file.name" />
<copy todir="/var/tmp">
<fileset file="${file.name}" />
</copy>
</macrodef>
<target name="go">
<copy-some-stuff file.name="/etc/hosts" />
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
但我得到以下内容
BUILD FAILED
b.xml:3: macrodef doesn't support the nested "copy" element.
Run Code Online (Sandbox Code Playgroud)
任何想法,除了"是,indeeed,macrodef不支持嵌套的"复制"元素." 我得到了那么多.我正在寻找为什么这个限制在这里和一个可能的解决方法(不使用antcall).
尝试用以下<copy>元素包围元素<sequential>:
<macrodef name="copy-some-stuff">
<attribute name="file.name" />
<sequential>
<copy todir="/var/tmp">
<fileset file="@{file.name}" />
</copy>
</sequential>
</macrodef>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2554 次 |
| 最近记录: |