Some rules throwing ClassNotFoundException
Brought to you by:
chrismair
So I'm running a CodeNarc as an ant task with a custom ruleset.
It was working just fine with my IllegalRegexRule rules, but I tried adding a new one.
I put this into my ruleset:
<rule class='org.codenarc.rule.formatting.MissingBlankLineAfterPackage'>
<property name='priority' value='1'/>
</rule>
And I see this when I build:
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (codenarc) on project myProject: An Ant BuildException has occured: java.lang.ClassNotFoundException: org.codenarc.rule.formatting.MissingBlankLineAfterPackage
Any idea why this is happening? Tried both version 0.18 and 0.21 of CodeNarc.
It looks like you are missing the "Rule" at the end of the class name: MissingBlankLineAfterPackageRule.
If you use the Groovy DSL ruleset rather than the XML format, you can just specify the rule name, e.g. "MissingBlankLineAfterPackage".
Thanks, that did it! Pretty bad oversight on my part...