This message was deleted.
# community-support
s
This message was deleted.
c
are you perhaps running Gradle itself with Java 8? Toolchains apply to what your buildscript is compiling - there’s still resolution etc for plugins that will be based on the Gradle JVM.
m
What’s the response from Artifactory? is it 404 or 403?
Artifactory will improperly cache responses for artifacts that were not previously present. it’s typically because the user requesting the missing artifact did not have the “cache permission” to put the new artifact into the repo. Typically, artifactory admins setup mirrors to pull the new artifact in automatically…but the “missing response” still gets cached and thus when you try resolving the dependency in Gradle, it fails
the workaround is to try requesting a different version of the artifact…this will bust the cache response
that might fail or succeed
then you change it back to the version you want
it should succeed then
c
This failure is not one of artifact resolution, it’s using the resolved artifact metadata to compare capabilities where the failure use. Gradle is expecting a Java 8 component but receiving a Java 17 one.
👍 1
m
just make sure that: 1. your submodules are using the same jdk17 2. the artifact is actually present in artifactory
@Chris Lee he said, “Have also ensured that the module settings are using the JDK 17. Have also set the java toolchain in each submodule to be 17.”
c
Correct. Likely the Gradle JVM is still Java 8 or there’s an otherwise incompatible artifact.
m
i think that the 1st issue might be the metadata…then he tried to simplify it by just using jdk17 everywhere
the fact he is using jdk17 for all the submodules and still getting the problem makes me think he’s not resolving the right artifact
gradle shouldn’t be expecting a jdk8 artifact if all he is requesting is jdk17 artifacts right?
c
it will if the Gradle JVM is Java 8 or other dependent artifact require Java 8.
👍 1
for example, if you are running Gradle on Java 8 but use a plugin that is for Java 17 - that will cause this error.
m
but he’s setting the java toolchain to 17…you think he’s got a daemon still on 8 or something?
c
that toolchain is only for compilation tasks. it doesn’t apply to what Gradle itself is running on for plugins etc.
m
mmm…ok i see what you’re saying now
a
ok lots of helpful things to dig into...will take a peek and circle back
thanks folks
👍 1
yup so indeed the jvm for gradle is 1.8 as determined by JAVA_HOME...the issue is all our other repos are legacy so I'd like to be able to specify this specifically for this one repo without clobbering the JAVA_HOME system property
any idea how I can do that easily
had thought I was solving that with the toolchain route, but clearly not 🙂
c
JAVA_HOME=/whatever ./gradlew
should do it.
a
you mean in the gradle.properties file?
c
that was for the command line. iirc this works for gradle.properties:
Copy code
org.gradle.java.home=/path_to_jdk_directory
❤️ 1
a
thanks Chris, testing now 🙂
👍 1
cool, I think that did the trick...looks like the gradle JVM is still using 1.8 from JAVA_HOME but the gradle.properties being set to 17 seems to be working...that was fun to debug 😄 😄
thanks a bunch
👍 2
p
Hi , I was facing relevant issue ..just a quick question on this..if there is a plugin which controls the compatibility of the java version is in sub projects. And the plugin project is on JDK17 , will there be any chance or any property apart from setting gradle.properties to set JDK to 1.8 version??? I tried setting org.gradle.java.home to 1.8 and couldn't get to work it.. thanks in advance
c
Have you looked at using Gradle java toolchains to provide separate (from what Gradle runs on) java versions as needed?