在Ant中,子构建失败没有使父构建失败

时间:2012-11-29 05:35:22

标签: ant

我使用build.xml从父build.xml呼叫孩子subant

 <target name="deploy-vc-orgstr">
    <subant target="deploy" failonerror="true">
      <fileset dir="${orgstr.vc.home}" includes="build.xml"/>
    </subant>
  </target>

当我从子build.xml获得编译错误时,我的父版本仍显示BUILD SUCCESSFUL。在日志中,我可以在构建目标“deploy-vc-orgstr”时看到编译错误。

如何在子构建失败时使父构建失败?

实际上我定义了两个目标。

target: deploy-vc-orgstr
target: deploy

我想如果目标“deploy-vc-orgstr”失败,那么目标“部署”也会失败。

我的build.xml是:

<?xml version="1.0" encoding="windows-1252" ?>
<!--Ant buildfile generated by Oracle JDeveloper-->
<!--Generated Nov 1, 2012 5:00:36 PM-->
<project name="SafetyExcellenceManagementSystem" default="deploy" basedir=".">
  <property file="build.properties"/>
  <!--Change to include model build Starts -->
<target name="deploy-vc-orgstr">
        <subant target="deploy" failonerror="true">
          <fileset dir="${orgstr.vc.home}" includes="*/build.xml"/>
        </subant>
      </target>
  <target name="init">
    <tstamp/>
    <mkdir dir="${output.dir}"/>
  </target>
  <target name="deploy" description="Deploy JDeveloper profiles"
          depends="init,deploy-vc-orgstr">
    <taskdef name="ojdeploy"
             classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask"
             uri="oraclelib:OJDeployAntTask"
             classpath="${oracle.jdeveloper.ant.library}"/>
    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${oracle.jdeveloper.ojdeploy.path}"
                  ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml"
                  ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml">
      <ora:deploy>
        <ora:parameter name="workspace"
                       value="${oracle.jdeveloper.workspace.path}"/>
        <ora:parameter name="profile"
                       value="${oracle.jdeveloper.deploy.profile.name}"/>
        <!--ora:parameter name="nocompile" value="true"/-->
        <ora:parameter name="outputfile"
                       value="${oracle.jdeveloper.deploy.outputfile}"/>
      </ora:deploy>
    </ora:ojdeploy>
  </target>
</project>

0 个答案:

没有答案