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