I am trying to port my maven settings to gradle and get another issue.
On maven I used <java.version>1.8</java.version> and on the compiler plugin
Now the question comes up how can I bring it to work on gradle too.
Therefor I already searched a lot of threads about that topic but it didn’t bring me a solution…
I tried to follow the ways mentioned on Compile with Java 11 to Java 8 language level - #5 by Vampire
Current build file and tries you can see on the github action itself. I am trying to use the javaToolchains.
BuildBattle/build.gradle at development · Plugily-Projects/BuildBattle (github.com)
Issue I get:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT.
Required by:
project :
> No matching variant of io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT:20221206.184705-189 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
> Task :compileJava FAILED
- Variant 'apiElements' capability io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT declares an API of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'javadocElements' capability io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
1 actionable task: 1 executed
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Variant 'runtimeElements' capability io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'sourcesElements' capability io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
or see github action fail · Plugily-Projects/BuildBattle@34f7e8f (github.com)
The goal should be to have a jar that works on java 8 but compiles with java 17