CodeNarc 1.5 with Grails 4

When I bumped CodeNarc from 1.4 to 1.5 at my Grails 4.x project, I kept getting the “groovy/text/TemplateEngine” error which is reported here: The suggested solution was not too clear, so here is exactly what you gotta do – add the following to build.gradle: codenarc “org.codenarc:CodeNarc:${codenarc.toolVersion}” codenarc ‘org.codehaus.groovy:groovy-templates’

Grails 4 IntegrationsTest cannot compile when using OpenClover

I just recently upgraded a Grails 2 plugin to Grails 4 and that gave me a weird problem that probably also applies to Grails 4 applications. Every time I ran ./gradlew check with gradle-clover-plugin (OpenClover) enabled, then I would get compile errors (“unable to resolve class” for /grails-app/**/*.groovy) during compileIntegrationTestGroovy. After endless trial-and-error, I realised […]

Adding @GrailsCompileStatic to all production grails code (not test grails code)

When coding Groovy, @CompileStatic can help to spot errors and improve performance of production code. Unfortunately, @CompileStatic is optional and hence easy to forget, but thankfully Groovy has documented a way to make @CompileStatic for all production code: (Test code is not affected, because it is nice with flexibility when testing.) However, with Grails […]