简体   繁体   中英

putting the appname in a codenarc report title

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"
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM