unimined / JvmDowngrader

downgrade java api and bytecode
https://jvmdowngrader.wagyourtail.xyz
Other
39 stars 2 forks source link

Cannot build from source #9

Closed Ledmington closed 1 week ago

Ledmington commented 1 week ago

Hi, first of all, really nice project!

I tried building it with various java versions but couldn't arrive at the end of the build with any of them. I am using gradle 8.8 and I tried running ./gradlew build.

With java 8 (temurin 8.0.412), I got this error:

> Task :buildSrc:compileKotlin
w: file:///root/JvmDowngrader/buildSrc/src/utils/kotlin/xyz/wagyourtail/jvmdg/util/Util.kt:42:17 Unchecked cast: Nothing? to T

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'JvmDowngrader'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.gradleup.nmcp:nmcp:0.0.7.
     Required by:
         project : > com.gradleup.nmcp:com.gradleup.nmcp.gradle.plugin:0.0.7
      > No matching variant of com.gradleup.nmcp:nmcp:0.0.7 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.7' but:
          - Variant 'apiElements' declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.7')
          - Variant 'runtimeElements' declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.7')

With java 11 (temurin 11.0.23), 17 (temurin 17.0.11) and 21 (temurin 21.0.3) I got this error:

> Task :buildSrc:compileKotlin
w: file:///root/JvmDowngrader/buildSrc/src/utils/kotlin/xyz/wagyourtail/jvmdg/util/Util.kt:42:17 Unchecked cast: Nothing? to T
Invalid Java installation found at '/root/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64' (provisioned toolchain). It will be re-checked in the next build. This might have performance impact if it keeps failing. Run the 'javaToolchains' task for more details.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':distTar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
   > Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
      > Unable to download toolchain matching the requirements ({languageVersion=7, vendor=any, implementation=vendor-specific}) from 'https://api.foojay.io/disco/v3.0/ids/45dfb704e8dcceab434285501d74cd33/redirect'.
         > Provisioned toolchain '/root/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64' could not be probed: Command returned unexpected result code: 139
           Error output:

Am I doing something wrong?

Geolykt commented 1 week ago

Looks as if gradle is throwing a tantrum and downloading the wrong JDK (Zing somehow doesn't work on a few linux desktops - instead segfaulting immediately). I'd nuke the /root/.gradle/jdks/zing20/ folder and manually install a Java 20 and Java 7 JDK, ensuring that it is discovered by gradle without it having to try to automatically install it (that is, by installing into the /usr/lib/jvm/ folder).

Repeat this process for all other java versions that fail to compile.

Gradle itself needs to be run with a Java 11+ JDK from the looks of it, so the first error is unavoidable.

Ledmington commented 1 week ago

I've managed to make it work by downloading zulu 7 manually (I could not find any "zing jdk" online other than Azul Zulu).

Geolykt commented 1 week ago

The zing version mentioned is an edition of azul zulu - I believe it's more for corporate use? Regardless it's broken on linux so there is no point in using it. Someone should probably report that to foojay, but complaining about it is a bit easier than actually filing the bug report only to be met by the obligatory "lol, just use Java 28"

Ledmington commented 1 week ago

Thank you for the help. Maybe it would be beneficial for new users to mention this issue in a "Build from source" section.