문제

just started with the codenarc plugin for grails - seems to be great! But now I try to configure a dynamic report title like this: "code quality report for ${appName}"

Unfortunately, it seems that the appName property is not available at the right time - I just get a null value.

Any ideas?

PS: using Grails 2.0.4 with ":codenarc:0.19"

도움이 되었습니까?

해결책

appName is by default bound in BuildConfig.groovy but is not available to the configuration closure for codenarc. I am yet to become cognizant of an absolute reasoning behind that behavior, unless anyone here throws some light on it. But you can very well read application.properties directly to get the appName as below:

codenarc.reports = {
    def props = new Properties()
    new File("application.properties").withInputStream {props.load(it)}

    MyHtmlReport('html') {
        outputFile = "${props['app.name']} - CodeNarc-Report.html"
        title = "${props['app.name']} - Sample Report"
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top