does java's `-release` check if a compile time dep...
# community-support
c
does java's
-release
check if a compile time dependency requires a greater version of java? e.g. I'm releasing against java 11 but I have a dependency that uses 17. If it does not, is there a way to do that? I seem to recall some dependency I've encountered requires 17, but I think it was a plugin. I'm also using 21 for generating javadoc, so ...
m
I don't think
-release
will do that but Gradle dependency resolution should? (assuming your dependencies have Gradle metadata)
Now how does Gradle dependency resolution knows what version of Java to use, I don't know
But it works:
Copy code
tasks.withType<JavaCompile>().configureEach {
  options.release.set(8)
}
dependencies {
  implementation("org.springframework.boot:spring-boot:3.3.5")
}
Copy code
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve org.springframework.boot:spring-boot:3.3.5.
     Required by:
         root project :
      > Dependency resolution is looking for a library compatible with JVM runtime version 8, but 'org.springframework.boot:spring-boot:3.3.5' is only compatible with JVM runtime version 17 or newer.
So to answer your question, it should work fine
c
if there's metadata... hrmf
m
Yea, that's quite the "if" 😅
Maybe pom has a similar thing? (not sure)
👎 1
c
I think it probably does, at the same time you probably have to set it explicitly
which no one probably does