snapcrafters / gradle

A community-maintained package to easily install Gradle on Linux
MIT License
8 stars 14 forks source link

[Bug]: Can't pass `JAVA_HOME` to the snap to use a different Java version #26

Open NatoBoram opened 2 years ago

NatoBoram commented 2 years ago

What happened?

JAVA_HOME="/usr/lib/jvm/java-18-openjdk-amd64" gradle wrapper
* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.11-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
   > You are using an outdated version of Java (16). Java 17 or higher is required.
     The JAVA_HOME environment variable is currently set to (/snap/gradle/134/usr/lib/jvm/java-1.16.0-openjdk-amd64).

What should have happened?

The supplied JAVA_HOME should've been used instead of the built-in one.

Output of snap info $snap_name

name:      gradle
summary:   An open-source build automation tool
publisher: Snapcrafters
store-url: https://snapcraft.io/gradle
contact:   https://github.com/snapcrafters/gradle/issues
license:   Apache-2.0
description: |
  Gradle is a build tool with a focus on build automation and support for multi-language
  development. If you are building, testing, publishing, and deploying software on any platform,
  Gradle offers a flexible model that can support the entire development lifecycle from compiling
  and packaging code to publishing web sites. Gradle has been designed to support build automation
  across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is
  closely integrated with development tools and continuous integration servers including Eclipse,
  IntelliJ, and Jenkins.
commands:
  - gradle
snap-id:      ODK1djMochvIgz8T5VxewEgw73OwALts
tracking:     latest/stable
refresh-date: 2021-10-18
channels:
  latest/stable:    7.2   2021-09-29 (134) 461MB classic
  latest/candidate: ↑                            
  latest/beta:      ↑                            
  latest/edge:      7.3.2 2021-12-20 (144) 463MB classic
  6.8.x/stable:     6.8.3 2021-05-26  (87) 203MB classic
  6.8.x/candidate:  ↑                            
  6.8.x/beta:       ↑                            
  6.8.x/edge:       ↑                            
installed:          7.2              (134) 461MB classic

Output of snap connections $snap_name

­

Output of snap version

snap    2.54.3+21.10.1ubuntu0.2
snapd   2.54.3+21.10.1ubuntu0.2
series  16
pop     21.10
kernel  5.15.23-76051523-generic

Relevant log output

No response

Teminal output of app

FAILURE: Build failed with an exception.

* Where:
Build file '/home/nato/Code/github.com/Traben-0/EmissiveMod/build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.11-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
   > You are using an outdated version of Java (16). Java 17 or higher is required.
     The JAVA_HOME environment variable is currently set to (/snap/gradle/134/usr/lib/jvm/java-1.16.0-openjdk-amd64).

* 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 620ms