我可以从两个目标运行我的构建文件,如下所示
start
但是,这两个目标都在内部调用" inheritedTarget"而这个"继承了目标"内部呼叫" makeMinification"目标
以下是" inheritedTarget"和#34; makeMinification"
<target name="makeMinificationTarget" depends="inheritedTarget" />
<target name="skipMinificationTarget" depends="inheritedTarget" />
我的问题是我想跳过&#34; makeMinification&#34;来自
的目标此致电<target name="makeMinification">
<echo message="makingMinification...">
</target>
<target name="inheritedTarget" depends="makeMinification"/>
<echo message="compileFiles">
<echo message="ExecuteFiles">
</target>
和
如果我们拨打<target name="skipMinificationTarget" depends="inheritedTarget" />
我怎样才能实现这一点?
答案 0 :(得分:1)
这有用吗?使用&#34; antcall&#34;并传递参数。而不是使用&#34;取决于&#34;
<target name="makeMinificationTarget" >
<antcall target="inheritedTarget">
<param name="Minification" value="true"/>
</antcall>
</target>
<target name="skipMinificationTarget" >
<antcall target="inheritedTarget">
<param name="Minification" value="false"/>
</antcall>
</target>
<target name="inheritedTarget" >
<if>
<equals arg1="${Minification}" arg2="true" />
<then>
<antcall target="makeMinification"/>
</then>
<else>
<!-- Do something else-->
</else>
</if>
<!-- Do other stuff -->
</target>
<target name="makeMinification" >
<!-- Do something -->
</target>