Resolving Codenarc Compilation Warnings

After seeing several developers on my team make simple style errors, I looked into updating our custom codenarc ruleset. Most of the rules were turned off and it had not been updated in almost 10 minor releases.  In general, the updates were wonderful. The code is cleaner and new pull requests are much easier to read! After the update; however, I noticed pages of warnings all in the style:

Codenarc Compilation Warnings
The task was still passing so I kept going for a while and made a note to fix it later.  Recently, I was digging through the Codenarc docs again and came across this:

NOTE: If a rule requiring a later compiler phase is included in the active CodeNarc ruleset and enabled and one or more of the required classes is not on the classpath, then CodeNarc will log a Log4J WARN message for each source file that contains the missing references.

in the section on Enhanced Classpath Rules

According to the documentation, the Grails plugin and Ant task support the enhanced rules, but our configuration uses the Gradle codenarc plugin which does not.  I turned off the enhanced rules and the warnings resolved.  If you are using Codenarc 0.19+ and you are seeing this error, this might be the problem for you too.

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]