Gradle wants as java version openjdk-11 even if a newer version is installed? . .

$ sudo apt-get install gradle --dry-run > jdk-11.txt

$ JAVA_HOME="/media/user/078TG33366666/graalvm-ce-java19-22.3.0"
PATH="${JAVA_HOME}/bin:$PATH"

which javac
javac -version

which java
java -version
/media/user/078TG33366666/graalvm-ce-java19-22.3.0/bin/javac
javac 19.0.1
/media/user/078TG33366666/graalvm-ce-java19-22.3.0/bin/java
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 19.0.1+10-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build
19.0.1+10-jvmci-22.3-b08, mixed mode, sharing)

$ sudo apt-get install gradle --dry-run > jdk-19.txt

$ diff jdk-11.txt jdk-19.txt
$

$ file jdk-11.txt jdk-19.txt
jdk-11.txt: ASCII text
jdk-19.txt: ASCII text

$ wc -l jdk-11.txt jdk-19.txt
348 jdk-11.txt
348 jdk-19.txt
696 total

$ ls -l jdk-11.txt jdk-19.txt
-rw-r--r-- 1 user user 21405 Mar 28 07:58 jdk-11.txt
-rw-r--r-- 1 user user 21405 Mar 28 07:59 jdk-19.txt

$ sha256sum jdk-11.txt jdk-19.txt
a9f91225693514bfdf4a1079d4a22f9f8086959bd8939b0b592cba042aff689e jdk-11.txt
a9f91225693514bfdf4a1079d4a22f9f8086959bd8939b0b592cba042aff689e jdk-19.txt
$

Is there a way to fix that? I am not sure if it is a Debian package maintenance issue.
lbrtchx

You usually don’t need any installed Gradle version anyway, as practically any Gradle project should include the four Gradle wrapper files to execute the build with a well-defined consistent Gradle version and you can bootstrap a new Gradle project either using the IDE or the Gradle wrapper of another project.

But besides that, you made not clear what your problem is, except that executing apt-get install gradle --dry-run outputs the same text if you run it twice. Is there something in those files you intended to share and didn’t?

Why would gradle still attempt to download and install jdk 11 after I specified a newer version?

Could you, please, “uncultured” your statements (it is not obvious, easy; I learned to do that when I became a teacher), functionally explaining (or pointing to an explanation of) what:

  1. “include” means (included in your PATH variable in Linux (so that is is reachable by other programs)?)
  2. which ones are the “four Gradle wrapper” (I thought there was only one since in the documentation they talk about “The Gradle Wrapper class” : “Gradle Wrapper”)?

Let me give myself a taste of my own medicine: when you run the Debian/Linux package installer with the “–dry-run” option it will show to you what it would do, or attempt to, in the background.
After I specified JAVA_HOME and included its JDK in the PATH, it should have “noticed” that java was already installed and used that (newer) version. I know it is not exactly a problem with gradle per se. I am just explaining what I was seeking with that dry run.

Why would gradle still attempt to download and install jdk 11 after I specified a newer version?

Gradle does not do.
What you called is an apt-get call, the older form of doing apt calls.
That is the package manager of your Linux distribution.
Whoever manages that Gradle package for that Linux distribution defines what packages it depends on.
If you do not have a package installed, but installed that newer Java manually, or installed a Java package that does not provide what that Gradle package is declaring as dependency, then the package manager is not happy with your newer Java.
But that is purely a topic for your package repository if you try to install Gradle from that package repository.
Alternatively, you can just download and unpack the official Gradle distribution manually as described at Gradle | Installation,
or just not install a Gradle version at all as mentioned before.

Could you, please, “uncultured” your statements

Unfortunately not, as I have no idea what you want from me, sorry. I’m not a native speaker.

  1. “include” means (included in your PATH variable in Linux (so that is is reachable by other programs)?)

“include”, as having them, added to version control, or the source zip or however the projects sources is distributed.

  1. which ones are the “four Gradle wrapper” (I thought there was only one since in the documentation they talk about “The Gradle Wrapper class” : “The Gradle Wrapper”)?

Not “four Gradle wrapper”, “four Gradle wrapper files”. You already linked to the exact documentation that explains it and also explicitly lists and explains the four files project sources should have with them (“include”).

After I specified JAVA_HOME and included its JDK in the PATH, it should have “noticed” that java was already installed and used that (newer) version.

Gradle itself would just use the Java from your JAVA_HOME or as fallback from PATH (given you use a version that is compatible with your Gradle version, otherwise it will most likely fail to execute later on).

But as explained above, the package manager does not care about what environment variables might be set. It just cares about installed packages and declared dependencies between these packages.