Groovy On Fedora Linux
As I’ve mentioned, I recently began using Fedora Linux on my laptop. As I was in the process of getting everything set up the way I needed, I wanted to install the Groovy scripting language. Initial indications made it look like it should be in the standard repositories, but running…
sudo dnf search groovy
… resulted in:
No matches found.
Clearly the information I saw was dated. I took to DuckDuckGo to search for a solution, and I quickly hit upon a thread referencing the exact same documentation I found and experiencing the same problem. Humorously enough, I actually recognized the poster of the question from one of the previous Mastodon instances I had used; I reached out to let them know that the post was helpful for me as well, 2 years later.
The recommendation from that thread was to use SDKMAN, which I had heard of but never used before. I actually looked at it briefly back when I got started with Groovy a few years ago but ultimately just ended up installing everything I needed on my work MacBook Pro at the time via Homebrew. Installation of SDKMAN was as simple as running the command provided on the site, though naturally you can always download the shell script for review first if you don’t want to curl
straight into bash
. Once the installation was done, finding Groovy was as simple as:
sdk list groovy
After verifying it was, in fact, available, I installed it via:
sdk install groovy
Note that this is done without sudo
as SDKMAN writes everything to a local ~/.sdkman
directory.
Of course, installing Groovy is only half the battle; I needed a JVM to run it on top of. SDKMAN has a ton of JDK options available; the full list is available here. I could also see them via:
sdk list java
The particular flavor didn’t really matter too much for me, so I opted for OpenJDK since it was the one I typically used in the past. However, running…
sdk install java open
… wasn’t quite enough. For Java, I also needed to specify the version. In this instance, I ran:
sdk install java 18-open
I picked 18 to get the latest stable version at the time of this writing:
After that, I was able to execute a simple script without any issues:
What’s extra nice is that I can use similar commands to keep my environment updated in the future if I need via sdk update
and sdk upgrade {package}
.
Originally published at https://borked.sh on May 22, 2022.