Closed jjathman closed 4 years ago
I see mentions of "spring" in classpath, so I suppose you are using dependency-management plugin to load BOMs. If yes, I assume you apply boms for all configurations (default usage) which may affect "codenarc" configuration too and reduce groovy version. I have a situation like this with spotbugs: it is described in docs now
First, you can revert codenarc: quality.codenarcVersion = 1.4
and look if everything goes well (which means new codenarc require newer groovy).
If you will not find the root cause please describe your setup (or, if possible, prepare reproducible example (maybe your project is already open?)) and I will look further.
OK here's the dependency insight output. Also, we are using BOMs but we are using them this way:
dependencies {
implementation platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
}
Which I think is the correct way to do this with Gradle now. We don't even use the Spring dependency management plugin. Is this still incorrect?
> Task :spring-initializr:dependencyInsight
org.codehaus.groovy:groovy:2.5.10 (selected by rule)
variant "runtime" [
org.gradle.status = release (not requested)
org.gradle.usage = java-runtime (not requested)
org.gradle.libraryelements = jar (not requested)
org.gradle.category = library (not requested)
]
org.codehaus.groovy:groovy:2.5.10
+--- org.codehaus.groovy:groovy-ant:2.5.10
| \--- org.codenarc:CodeNarc:1.5 (requested org.codehaus.groovy:groovy-ant:2.3.11)
| \--- codenarc
\--- org.codehaus.groovy:groovy-xml:2.5.10
\--- org.codenarc:CodeNarc:1.5 (requested org.codehaus.groovy:groovy-xml:2.3.11) (*)
org.codehaus.groovy:groovy:2.3.11 -> 2.5.10
\--- org.codenarc:CodeNarc:1.5
\--- codenarc
org.codehaus.groovy:groovy-ant:2.5.10 (selected by rule)
variant "runtime" [
org.gradle.status = release (not requested)
org.gradle.usage = java-runtime (not requested)
org.gradle.libraryelements = jar (not requested)
org.gradle.category = library (not requested)
]
org.codehaus.groovy:groovy-ant:2.3.11 -> 2.5.10
\--- org.codenarc:CodeNarc:1.5
\--- codenarc
org.codehaus.groovy:groovy-groovydoc:2.5.10 (selected by rule)
variant "runtime" [
org.gradle.status = release (not requested)
org.gradle.usage = java-runtime (not requested)
org.gradle.libraryelements = jar (not requested)
org.gradle.category = library (not requested)
]
org.codehaus.groovy:groovy-groovydoc:2.5.10
\--- org.codehaus.groovy:groovy-ant:2.5.10
\--- org.codenarc:CodeNarc:1.5 (requested org.codehaus.groovy:groovy-ant:2.3.11)
\--- codenarc
org.codehaus.groovy:groovy-xml:2.5.10 (selected by rule)
variant "runtime" [
org.gradle.status = release (not requested)
org.gradle.usage = java-runtime (not requested)
org.gradle.libraryelements = jar (not requested)
org.gradle.category = library (not requested)
]
org.codehaus.groovy:groovy-xml:2.3.11 -> 2.5.10
\--- org.codenarc:CodeNarc:1.5
\--- codenarc
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
Switching to codenarc version 1.4 also fixed the problem. Something must have changed in their dependencies to cause this issue I guess? Our project's structure hasn't changed at all.
Yep, version 1.4 uses groovy-all
, 1.5 is using individual groovy libraries. I see it's pulling in groovy-ant
which I think should pull in groovy-templates
. Not sure why that isn't working.
Yes, importing BOM with gradle native support should not affect codenarc configuration. But still, your problem is incorrect groovy version: org.codehaus.groovy:groovy:2.5.10 (selected by rule)
. So something affects it in your build. Maybe you apply rules with configurations.all { .. }
or it is side effect from some plugin.
I did update plugin in quality plugin itself and I have correct groovy there:
> Task :dependencyInsight
org.codehaus.groovy:groovy:2.3.11
variant "runtime" [
org.gradle.status = release (not requested)
org.gradle.usage = java-runtime (not requested)
org.gradle.libraryelements = jar (not requested)
org.gradle.category = library (not requested)
]
org.codehaus.groovy:groovy:2.3.11
+--- org.codehaus.groovy:groovy-ant:2.3.11
| \--- org.codenarc:CodeNarc:1.5
| \--- codenarc
+--- org.codehaus.groovy:groovy-groovydoc:2.3.11
| \--- org.codehaus.groovy:groovy-ant:2.3.11 (*)
+--- org.codehaus.groovy:groovy-templates:2.3.11
| \--- org.codehaus.groovy:groovy-groovydoc:2.3.11 (*)
+--- org.codehaus.groovy:groovy-xml:2.3.11
| +--- org.codenarc:CodeNarc:1.5 (*)
| \--- org.codehaus.groovy:groovy-templates:2.3.11 (*)
\--- org.codenarc:CodeNarc:1.5 (*)
But I'm still on gradle 5.6.4. What is your gradle version? I will try with newer gradle later to be sure, but I doubt it will change something.
We are using Gradle version 6.3, do you want to give that a try? From what I can see it doesn't look like a Groovy version problem, it seems like that entire dependency isn't being pulled in. I'm still looking in to it.
Apologies, after digging through the project more thoroughly I found it was still pulling in the spring dependency management plugin even though we weren't using it for anything. Removing that fixed the issue. Sorry.
We have a project which uses Groovy and the CodeNarc scanning that the quality plugin provides. Writing reports seems to be broken after the upgrade from 4.1.0 to 4.2.1. It fails with
> java.lang.NoClassDefFoundError: Lgroovy/text/TemplateEngine;
. Any ideas?