We have a project in my org using gradle 3.5.1 and codenarc which was working fine, but this week started failing with the error java.lang.NoClassDefFoundError: groovy/text/SimpleTemplateEngine
for the codenarc tasks. We traced this down to the fact that the version of Groovy for the codenarc configuration is getting increased from 2.1.8
to 3.0.0-alpha-4
which doesn’t have the necessary implementation.
I’m unable to determine why the version of Groovy is getting resolved to the newer version. Codenarc clearly declares 2.1.8 as the dependent version and nothing else appears to be referencing anything newer.
Even with the below, stripped down, build.gradle
, we get the same result. Seems to clear up under gradle 4.+, so we’re looking at making the move but that might take a little time.
Just wondering if anyone could point out something we might be missing that explains this.
Thanks much.
build.gradle
apply plugin: 'groovy'
apply plugin: 'codenarc'
repositories {
jcenter()
}
output of: gradle dependencies --configuration codenarc
codenarc - The CodeNarc libraries to be used for this project.
\--- org.codenarc:CodeNarc:0.25.2
+--- junit:junit:4.8.1
+--- org.codehaus.groovy:groovy-xml:2.1.8 -> 3.0.0-alpha-4
| \--- org.codehaus.groovy:groovy:3.0.0-alpha-4
+--- org.codehaus.groovy:groovy:2.1.8 -> 3.0.0-alpha-4
+--- org.codehaus.groovy:groovy-ant:2.1.8 -> 3.0.0-alpha-4
| +--- org.codehaus.groovy:groovy:3.0.0-alpha-4
| +--- org.codehaus.groovy:groovy-groovydoc:3.0.0-alpha-4
| +--- org.apache.ant:ant-junit:1.10.5
| \--- org.apache.ant:ant-antlr:1.10.5
\--- org.gmetrics:GMetrics:0.7
+--- org.codehaus.groovy:groovy:[2.1.0,) -> 3.0.0-alpha-4
+--- org.codehaus.groovy:groovy-xml:[2.1.0,) -> 3.0.0-alpha-4 (*)
\--- org.codehaus.groovy:groovy-ant:[2.1.0,) -> 3.0.0-alpha-4 (*)
(*) - dependencies omitted (listed previously)
output of gradle dependencyInsight --configuration codenarc --dependency groovy
org.codehaus.groovy:groovy:3.0.0-alpha-4
+--- org.codehaus.groovy:groovy-ant:3.0.0-alpha-4
| +--- org.codenarc:CodeNarc:0.25.2
| | \--- codenarc
| \--- org.gmetrics:GMetrics:0.7
| \--- org.codenarc:CodeNarc:0.25.2 (*)
\--- org.codehaus.groovy:groovy-xml:3.0.0-alpha-4
+--- org.codenarc:CodeNarc:0.25.2 (*)
\--- org.gmetrics:GMetrics:0.7 (*)
org.codehaus.groovy:groovy:2.1.8 -> 3.0.0-alpha-4
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc
org.codehaus.groovy:groovy:[2.1.0,) -> 3.0.0-alpha-4
\--- org.gmetrics:GMetrics:0.7
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc
org.codehaus.groovy:groovy-ant:3.0.0-alpha-4 (conflict resolution)
org.codehaus.groovy:groovy-ant:2.1.8 -> 3.0.0-alpha-4
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc
org.codehaus.groovy:groovy-ant:[2.1.0,) -> 3.0.0-alpha-4
\--- org.gmetrics:GMetrics:0.7
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc
org.codehaus.groovy:groovy-groovydoc:3.0.0-alpha-4 (conflict resolution)
\--- org.codehaus.groovy:groovy-ant:3.0.0-alpha-4
+--- org.codenarc:CodeNarc:0.25.2
| \--- codenarc
\--- org.gmetrics:GMetrics:0.7
\--- org.codenarc:CodeNarc:0.25.2 (*)
org.codehaus.groovy:groovy-xml:3.0.0-alpha-4 (conflict resolution)
org.codehaus.groovy:groovy-xml:2.1.8 -> 3.0.0-alpha-4
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc
org.codehaus.groovy:groovy-xml:[2.1.0,) -> 3.0.0-alpha-4
\--- org.gmetrics:GMetrics:0.7
\--- org.codenarc:CodeNarc:0.25.2
\--- codenarc