如何在_Events.groovy中失败'war'构建?

时间:2012-09-25 21:14:53

标签: grails war

我希望在某些情况下_Events.groovy中的eventListener闭包中的构建失败。

我尝试了两种方法:

  1. 抛出RuntimeException()
  2. 致电ant.fail('failing the build')
  3. 我在控制台中获得以下输出:

        | Building WAR file.....
        running event listener code...
        [ERROR] Invalid environment argument of: 'tingaeuaeou', must be either 'testing', 'package', 'production' or 'native'
        | Error Exception occurred trigger event [CreateWarStart]: Sencha SDK optimization failed. (Use --stacktrace to see the full trace)
        | Done creating WAR target/product-selector-0.1.war
        grails> 
    

    这是我编写的代码,试图使构建失败:

                ...
        ant.exec(outputproperty: "cmdOut", executable: 'sencha',
                dir: "$stagingDir", failOnError: true) {
            arg(value: 'app')
            arg(value: 'build')
            arg(value: "-e $senchaEnvironment")
        }
    
        def commandOutput = ant.project.properties.cmdOut
    
        println "${commandOutput}"
    
        if(commandOutput.contains('ERROR')){
            ant.fail(message:"Sencha SDK optimization failed.",status:1)
        }
                ...
    

    问题是war脚本继续运行,生成一个将被破坏的war文件,我不认为我的构建过程会报告发生异常;我的持续集成构建将报告错误的成功!

    有什么想法吗?

0 个答案:

没有答案
相关问题