Cruisecontrol发布命令onfailure

a.s*_*wab 2 cruisecontrol.net conditional publisher

发布我当前的项目状态时遇到问题.

制图:

<publishers>  
  <xmllogger /><!-- Log For WebDashboard ##Do not remove##-->    
  <email>
    ...
  </email>
  <onfailure>  
    <exec>
      <executable>echo ERROR > logs/status.txt</executable>
    </exec>
  </onfailure>            
</publishers>
Run Code Online (Sandbox Code Playgroud)

当我想启动我的服务时,我收到以下消息:

ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:无法从配置文档中实例化CruiseControl项目.配置文档可能缺少正确填充CruiseControl配置所需的Xml节点.无法加载数组项'onfailure' - 无法从类型System.String转换为ThoughtWorks.CruiseControl.Core.ITask为具有值的对象:"echo ERROR> logs/status.txt"

有谁知道这个消息是什么意思?

谢谢你的期待

亚历克斯

Ben*_*ann 5

您使用的是CruiseControl还是CruiseControl.NET?

如果是CC.NET,则"onfailure"节点不存在.相反,你应该像这样使用Conditionnal Publisher [1]:

<conditionalPublisher>
    <conditions>
        <condition>Failure</condition>
    </conditions>
    <publishers>
        <exec>
            <executable>echo ERROR > logs/status.txt</executable>
        </exec>
    </publishers>
</conditionalPublisher>
Run Code Online (Sandbox Code Playgroud)

您可能还需要将回显任务封装在cmd调用中:

<exec>
    <executable>cmd.exe</executable>
    <buildArgs>/c "echo ERROR > logs\status.txt"</buildArgs>
</exec>
Run Code Online (Sandbox Code Playgroud)

[1] http://ccnetlive.thoughtworks.com/ccnet/doc/CCNET/Conditional%20Publisher.html