-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeNarc + JDK17 + Groovy 4.0.7 #723
Comments
I had similar issues when trying to upgrade nom-groovy-lint with jdk17 & groovy4 compliance, so i'm very interested in the answer :) |
I'm having trouble reproducing this issue. Your stacktrace includes "org.codehaus.groovy.vmplugin.v8.Java8.doPrivileged" which makes me think that it is running Groovy 3 (org.codehaus.groovy) rather than Groovy 4 (org.apache.groovy). And perhaps also the "Java8" hints at a problem as well. If you are using the groovy-4.0 jar, then the classpath should not contain Groovy 3 jars. So how/where are you running this and can you determine full classpath and what/where the Groovy version is coming from? |
To help clarify the errors, I did some tests:
|
Groovy 4x + JDK17 + CodeNark-Groovy.4 [https://mvnrepository.com/artifact/org.codenarc/CodeNarc-Groovy4/] = Not Work :( It seems to me when it's run with JDK17, codenarc doesn't find any if/else and ends up getting a Java8 default:
|
I'm still not able to reproduce. I see you are using CodeNarcTask, within a JUnit test. And your stacktrace implies running within IntelliJ IDEA. Do you get the same error when you run the tests from the command-line, e.g. |
Yes, I'm using it via JUnit with IntelliJ import groovy.ant.AntBuilder
|
I did some others tests: Groovy 4.0.1 + JDK17 + CodeNarkGroovy[4]3.1.0 = Work!
|
I believe it is nothing related to the IDE, but to changes in the version of groovy. |
Well that is very interesting. And very helpful! Thanks for experimenting and researching that. |
Is groovy the only groovy artifact you are pulling in? You would need either the groovy-all jar or else the other groovy modules, depending on what feature you are using: groovy, groovy-xml, groovy-groovydoc, groovy-json, groovy-ant, , groovy-templates. I acknowledge that the CodeNarc home page does not make that explicit/clear. I would expect that explicitly declaring a version other than 4.0.1 (which is the version the current 3.1.0-groovy-4.0 version builds with) just for the groovy module could be incompatible with the transitive dependencies for the other groovy modules that CodeNarc builds with (see its build-groovy4.gradle file) -- so perhaps that could explain why 4.0.1 "worked" and the later 4.0.x did not? And your example up top indicated the artifact:version CodeNarc:3.1.0-groovy-4.0, but the later dependency was for CodeNarc-Groovy4:3.1.0. You should be using CodeNarc:3.1.0-groovy-4.0. |
Ugh. For what it's worth, I am still unable to reproduce this issue.
My JUnit test using AntBuilder is the same as your And my Gradle build file:
|
Hello people
I'm using codnarc with groovy 3 and everything is ok. When I put it to use with Groovy 4 it generated this error:
My Pom is:
Any tips on how to get it right?
Regards
The text was updated successfully, but these errors were encountered: