Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 蚂蚁依赖于导致错误行为的属性_Ant - Fatal编程技术网

Ant 蚂蚁依赖于导致错误行为的属性

Ant 蚂蚁依赖于导致错误行为的属性,ant,Ant,我有两个蚂蚁任务。如果我从命令行一个接一个地运行它们——没有问题 但是,如果我将它们包含在另一个任务的属性中,像这样dependens='taskA,taskB'我会得到错误的结果 依赖项是否以串联而不是顺序运行?没有深入到ant任务的细节——有什么想法吗?ant只执行一次相关任务。。。下面的例子说明了这种奇怪的行为 这属于特性而不是bug的范畴。这就是蚂蚁的工作方式。要记住的是,ANT不是作为过程编程语言设计的 如果您的子任务本质上是过程性的,那么最好将其作为一个函数调用(或者更好地创建一个可

我有两个蚂蚁任务。如果我从命令行一个接一个地运行它们——没有问题

但是,如果我将它们包含在另一个任务的属性中,像这样
dependens='taskA,taskB'
我会得到错误的结果


依赖项是否以串联而不是顺序运行?没有深入到ant任务的细节——有什么想法吗?

ant只执行一次相关任务。。。下面的例子说明了这种奇怪的行为

这属于特性而不是bug的范畴。这就是蚂蚁的工作方式。要记住的是,ANT不是作为过程编程语言设计的

如果您的子任务本质上是过程性的,那么最好将其作为一个函数调用(或者更好地创建一个可重用的构建函数)

例子 编译文件
它们是按顺序运行的。为了得到一个有用的答案,你必须分享更多关于什么事情没有按预期发生的信息。在三个Ant任务中添加一个回音,并对顺序/输出进行注释,怎么样?
$ ant
Buildfile: /path/to/my/home/build.xml

subtask1:
     [echo] hello world

subtask2:
     [echo] hello world

build1:
     [echo] hello world

build2:
     [echo] hello world

build:

BUILD SUCCESSFUL
<project name="demo" default="build">

   <target name="build" depends="build1,build2"/>

   <target name="build1" depends="subtask1,subtask2">
      <echo message="hello world"/>
   </target>

   <target name="build2" depends="subtask1,subtask2">
      <echo message="hello world"/>
   </target>

   <target name="subtask1">
      <echo message="hello world"/>
   </target>

   <target name="subtask2">
      <echo message="hello world"/>
   </target>

</project>