This message was deleted.
# community-support
s
This message was deleted.
e
you have some module
foo
that only works on Java 17+, and some other module
bar
that uses
foo
, and you're expecting some way to run
bar
on Java 8?
v
As he says "put into the same jar" I guess he builds a bloody fat jar from a multi-project build and now has problems because the Gradle Module Metadata states it requires Java 17 as the fat jar is probably built in one of the Java 17 projects. But just a wild guess.
If what I said is correct, just don't try to build a fat jar. If you have a reason to separate your code into mutliple projects, then also publish them individually and you don't have any problem. 😉
j
It’s because Minecraft like nms version support a module for 1.18 can be coded in Java 17 but NMs for 1.12 have to be in Java 8 and they go in the same jar
Then it picks based on what version it’s on
v
Oh, Minecraft, then non-fat jars are not trivial due to the stupid framework they built. 😕
e
if you're manually creating a mrjar, you can configure the toolchain for the compile job of different sourcesets differently
j
But you get that error above
e
(but using the term "module" is a bit confusing here)
j
Ah that’s my bad
v
You can also force the Java version attribute of that artifact to be 8, not 17 if you are sure what you are doing
e
unless you're trying to build a mrjar using jars from different subprojects?
I'm not sure I understand your setup
v
Doesn't matter much either way. The main artifact will have the Java compatibility of the main compile task iirc.
So whether the main compile task is Java 17, no matter if in mutliple source sets or projects, the GMM will have Java 17 in it
Either the main compile task must be Java 8, or the Java version attribute forced to be 8 if that really is the wanted outcome
For the attribute variant, for example
Copy code
val apiElements by configurations.getting
val runtimeElements by configurations.getting
configure(listOf(apiElements, runtimeElements)) {
    attributes {
        attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
    }
}
👍 1