snapcrafters / gradle

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

Snap does not update PATH variable which results in unusable snap #11

Closed K0-RR closed 3 years ago

K0-RR commented 3 years ago

I installed gradle via snap, then installed Java 16 needed to build a project and removed Java 11. The problem is snap still points to nonexisting Java 11.

You are using an outdated version of Java (11). Java 16 or higher is required.
The JAVA_HOME environment variable is currently set to (/snap/gradle/101/usr/lib/jvm/default-java).

Tried removing and installing this snap again, sudo systemctl restart snapd snapd.socket and sudo systemctl daemon-reload with no luck.

brlin-tw commented 3 years ago

The problem is snap still points to nonexisting Java 11.

It appears that Gradle points to the Java runtime bundled in the snap itself instead of the one possibly installed in the host system. Please try reproducing the issue again on a snap built with the modification in PR #12.

tunix commented 3 years ago

The error probably shows up like that because the project probably references against Java 16. Java 11 is perfectly fine and should not cause any trouble. Gradle seems to work fine with Java 8+

The change is ok.

K0-RR commented 3 years ago

Please try reproducing the issue again on a snap built with the modification in PR #12.

How can I manually build a snap?

brlin-tw commented 3 years ago

Install the snapcraft snap, then run the snapcraft command in the checked-out source tree in a text terminal.

tunix commented 3 years ago

I created another PR (#14) which fixes build issues. Once it's merged, it'll push new builds into the candidate channel so that you can test & let us know.

tunix commented 3 years ago

I just pushed latest changes to candidate channel.

Install via:

snap install gradle --classic --candidate

Update to candidate channel if you already installed it:

snap refresh gradle --candidate

Please test and report back if you have any other issues.