Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on gradlew shadowJar #2103

Open
IgorWolbers opened this issue Mar 3, 2023 · 5 comments
Open

Exception on gradlew shadowJar #2103

IgorWolbers opened this issue Mar 3, 2023 · 5 comments

Comments

@IgorWolbers
Copy link

IgorWolbers commented Mar 3, 2023

Expected Behavior

That the ./gradlew shadowJar command work with a clean install.

Actual Behavior

The command erred.

Steps to Reproduce

Debug information

Crashdump, Backtrace or Other Files

pi:~/Nukkit $ ./gradlew shadowJar
Downloading https://services.gradle.org/distributions/gradle-8.0.1-bin.zip
...........10%............20%............30%............40%............50%............60%...........70%............80%............90%............100%

Welcome to Gradle 8.0.1!

Here are the highlights of this release:
 - Improvements to the Kotlin DSL
 - Fine-grained parallelism from the first build with configuration cache
 - Configurable Gradle user home cache cleanup

For more details see https://docs.gradle.org/8.0.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
Invalid Java installation found at '/usr/lib/jvm/openjdk-11' (Common Linux Locations). 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 ':shadowJar'.
> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
   > SystemInfo is not supported on this operating system.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 45s
pi:~/Nukkit $ ./gradlew --version

------------------------------------------------------------
Gradle 8.0.1
------------------------------------------------------------

Build time:   2023-02-17 20:09:48 UTC
Revision:     68959bf76cef4d28c678f2e2085ee84e8647b77a

Kotlin:       1.8.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.18 (Raspbian 11.0.18+10-post-Raspbian-1deb11u1)
OS:           Linux 5.15.84-v7l+ arm
pi:~/Nukkit $ java --version
openjdk 11.0.18 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Raspbian-1deb11u1)
OpenJDK Server VM (build 11.0.18+10-post-Raspbian-1deb11u1, mixed mode)
@siom79
Copy link
Contributor

siom79 commented Mar 11, 2023

I ran into the same issue. The problem is this line in the build.gradlefile:

vendor.set(JvmVendorSpec.ADOPTIUM)

After commenting it out, I was able to build the server on my Raspberry Pi 4 with openjdk-armf successfully.

@siom79
Copy link
Contributor

siom79 commented Mar 11, 2023

The PR above fixes this problem for users that don't want to use or cannot use Adoptium JDK.

@siom79
Copy link
Contributor

siom79 commented Mar 12, 2023

The root cause seems to be this gradle issue: gradle/gradle#19295
Hence, I have close the PR.

@aschwtzr
Copy link

aschwtzr commented Mar 17, 2023

I'm still getting this issue though I see it's been removed from the gradle file.

pi@pi4:~/Nukkit$ ./gradlew --version

------------------------------------------------------------
Gradle 8.0.1
------------------------------------------------------------

Build time:   2023-02-17 20:09:48 UTC
Revision:     68959bf76cef4d28c678f2e2085ee84e8647b77a

Kotlin:       1.8.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.18 (Ubuntu 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OS:           Linux 5.15.0-1025-raspi arm

pi@pi4:~/Nukkit$ java --version
openjdk 11.0.18 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OpenJDK Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu122.04, mixed mode)
pi@pi4:~/Nukkit$ ./gradlew shadowJar
Invalid Java installation found at '/usr/lib/jvm/openjdk-11' (Common Linux Locations). 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 ':shadowJar'.
> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
   > SystemInfo is not supported on this operating system.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

And the output of javaToolChains

pi@pi4:~/Nukkit$ ./gradlew javaToolchains

> Task :javaToolchains

Invalid Java installation found at '/usr/lib/jvm/openjdk-11' (Common Linux Locations). 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.
 + Options
     | Auto-detection:     Enabled
     | Auto-download:      Enabled

 + Ubuntu JDK 11.0.18+10-post-Ubuntu-0ubuntu122.04
     | Location:           /usr/lib/jvm/java-11-openjdk-armhf
     | Language Version:   11
     | Vendor:             Ubuntu
     | Architecture:       arm
     | Is JDK:             true
     | Detected by:        Common Linux Locations

 + Invalid toolchains
     + /usr/lib/jvm/openjdk-11
       | Error:              A problem occurred starting process 'command '/usr/lib/jvm/openjdk-11/bin/java''
       |     Caused by:      Could not start '/usr/lib/jvm/openjdk-11/bin/java'
       |     Caused by:      Cannot run program "/usr/lib/jvm/openjdk-11/bin/java" (in directory "/home/pi/.gradle/.tmp/tmp-jvm9459728736584011795probe"): error=2, No such file or directory
       |     Caused by:      error=2, No such file or directory


BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed

I'm not super familiar with Java but seems in my case there's also an issue with how the JDK was installed.

Edit: missed the comment earlier with the link to the Gradle issue. Seems this on their end and I'm not seeing any workarounds.

@SupremeMortal
Copy link
Member

Installing Java 8 on your system should allow Gradle to pick up the installation and compile it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants