Hi there, I just opened this ticket but i’m worrie...
# getting-started
s
Hi there, I just opened this ticket but i’m worried it’s my own problem, is there anyone here who can tell me so I don’t waste the maintainers time: https://github.com/joreilly/PeopleInSpace/issues/320
l
The error says:
Copy code
Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
You need to use Java 17.
s
I switched to java 17. The error persists.
Also, usually, when the problem is the JDK version on my machine, the error indicates that the bytecode of some dependency is newer than what my jdk supports. This error looks very different.
l
What version did you declare in the gradle file?
s
I didn't declare anything, just opened the project root directory and it threw the error
c
It looks like the SQLDelight plugin only supports Java 17+. I can reproduce your problem with OpenJDK 11, but not with OpenJDK 17 (and that's consistent with the error message).
I switched to java 17. The error persists.
Are you running Gradle in the CLI, in IntelliJ, or some other way?
s
fleet
c
Sorry, not idea how to change the JDK there, I don't use it
s
i set it to java 17 there and i’m pretty confident it’s using it. i’m thinking it might be my cache then?
like, maybe it downloaded some of the jars when i had it using JDK 11, and now that i’ve switched, i need to clear cache and run again clean?
i can also just try running gradle. hang on
if you know an easy command to clear my cache, would be great as well
c
You can see which JDK version Gradle is running with using
./gradlew --version
, if you have a way to run that
Gradle cache?
rm -rf ~/.gradle .gradle
(first one is user-level cache, second one is project-level cache, ensure you run that wherever
gradlew
is)
s
no i think it would be the jar cache. like my m2 folder or whatever.
c
yep, that's that command 🙂
it's
~/.gradle/caches/modules-2
or something like that IIRC
s
ok, i thought it defaulted to a profile level
~/.m2
directory or something
says JVM 17.0.9
c
Not by default, but maybe something in the project or your device makes it do that
s
oh wait i see thats a profile level gradle directory
i didn’t see the ~ in your command to begin with. yeah i think that’s it.
c
yep, there are two
.gradle
dirs
s
looks like it’s rebuilding cache and updating indexes etc
c
if it reaches indexation, I believe your problem is fixed
s
wait, hang on, i commented out all the sqldelight lines in gradle files, let me uncomment and rerun
🤣 1
c
(it crashed when it started to download the plugins used by the build.gradle.kts files itself)
s
I agree i think we’re past the problem. Now it’s just taking forever to resolve js dependencies
thank yo so much for your help
c
ah, yep, that's normal 😅
no problems
maybe add a comment to the issue before closing it, explaining what the fix is, it's possible the maintainer is not aware their project requires JDK 17 to build
Officially, Gradle recommends plugins to support down to JDK 8… I tend to only support 11+, it's way too much work otherwise
s
well such recommendations should always include context. if you’re going to publish a gradle plugin which will probably be super-popular, like SQLDelight, and you’re a big company, like square, then yeah that guideline makes sense. If you’re building a private, or even a niche esoteric experimental public plugin, then do what you gotta do to move forward.
c
Of course! But well, it is a super-popular plugin created by a big company 🙂