Fresh Gradle installation error

Hi guys,

I did fresh installation of Gradle on Debian 12 but unfortunately after the installation I see the error below:

Documents/gradle$ gradle init --info
Initialized native services in: /home/myuser/.gradle/native
Initialized jansi services in: /home/myuser/.gradle/native
Received JVM installation metadata from '/usr/lib/jvm/java-17-openjdk-amd64': {JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64, JAVA_VERSION=17.0.10, JAVA_VENDOR=Debian, RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=17.0.10+7-Debian-1deb12u1, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=17.0.10+7-Debian-1deb12u1, VM_VENDOR=Debian, OS_ARCH=amd64}
The client will now receive all logging from the daemon (pid: 1905205). The daemon log file: /home/myuser/.gradle/daemon/8.7/daemon-1905205.out.log
Starting 10th build in daemon [uptime: 42 mins 22.826 secs, performance: 99%, GC rate: 0.00/s, heap usage: 0% of 512 MiB, non-heap usage: 12% of 384 MiB]
Using 8 worker leases.
Now considering [/home/myuser/Documents/gradle] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
Settings evaluated using settings file '/home/myuser/Documents/gradle/settings.gradle'.
Projects loaded. Root project using build file '/home/myuser/Documents/gradle/build.gradle'.
Included projects: [root project 'gradle']

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'gradle'.
> java.nio.file.NoSuchFileException: /home/myuser/Documents/gradle/lib/plugins/gradle-diagnostics-8.7.jar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --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 345ms

My version of Gradle and Java is:

Documents/gradle$ gradle --version

------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------

Build time:   2024-03-22 15:52:46 UTC
Revision:     650af14d7653aa949fce5e886e685efc9cf97c10

Kotlin:       1.9.22
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.10 (Debian 17.0.10+7-Debian-1deb12u1)
OS:           Linux 6.1.0-18-amd64 amd64

Any help?
I’m totally new with Gradle.

Regards,
Ivo

Did you unpack Gradle to /home/myuser/Documents/gradle/ and then in there run gradle init?
If so, that’s a very bad idea.
With the init task you initialize a new build in an empty directory.

Besides that, you usually should never have any version of Gradle installed.
All Gradle builds should contain the 4 Gradle wrapper files and you should always use the Gradle wrapper to execute a given build.

To start a new Gradle project, you usually can just let your IDE generate the initial files, or use the wrapper of another project to initialize the new project.

A locally installed Gradle you really only need if you either want to initialize a new project without any IDE or other Gradle project, or if you need to run a bad-practice project that does not contain the 4 wrapper files.

Hi @Vampire ,

Gradle was download as archive and moved to /opt/gradle. This is test folder for new project.

Then did you maybe set GRADLE_HOME environment variable to /home/myuser/Documents/gradle/ or similar?
The lib/plugins/gradle-diagnostics-8.7.jar file it searches is a file in the Gradle distribution.
If so, don’t set that environment variable at all.

I follow this article for the installation: How to Install Gradle on Debian 11 | Atlantic.Net

About “GRADLE_HOME” I didn’t change anything and I assume is the default. The only difference is that, I downloaded the newest version of Gradle from the website (gradle-8.7-all.zip).

In /etc/profile.d/gradle.sh I have:
export PATH=/opt/gradle/bin:/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin

The jar file exists:

314K Apr 15 16:34 /opt/gradle/lib/plugins/gradle-diagnostics-8.7.jar

Well, hard to guess what is wrong. Imho the whole article is an error. You usually should never install any Gradle version. If you really want to, just to apt install gradle. That will install an ancient version but at least it should work unless you broke something else. But as I said, usually you should not install any Gradle version anyway but always use the wrapper.