代码之家  ›  专栏  ›  技术社区  ›  TK.

在nant构建失败后清理

  •  3
  • TK.  · 技术社区  · 16 年前

    Target= Software.Build
    
    Target= Software.Build.Success *(depends on Software.Build succeeding)*
    
    Target= Software.Build.Failed
    

    我正在寻找一个解决方案,如果软件。构建目标失败了生成软件失败将执行,例如通过电子邮件向某人发送构建失败的消息,否则软件.构建.成功将运行以允许生成脚本继续。

    南特有这种可能吗?如果是的话,有人能给我指一个合适的文章/解决方案吗?

    2 回复  |  直到 16 年前
        1
  •  4
  •   The Chairman    16 年前

    NAntContrib 有一个 trycatch task :

    <trycatch>
      <try>
        <call target="Software.Build" />
      </try>
      <catch>
        <call target="Software.Build.Failed" />
        <fail message="build failed" />
      </catch>
      <finally>
        <!-- execute everything that doesn't depend on success or failure -->
      </finally>
    </trycatch>
    <call target="Software.Build.Success" />
    
        2
  •  6
  •   Dennis    16 年前

    <property name="nant.onfailure" value="failure" />
    <target name="failure">
        <!-- Put your cleaning code in here -->
    </target>