Most Java CLI tools stop at mvn compile exec:java.

That works locally. It doesn’t scale.

In this guide I show how to:
- build a fat JAR
- automate GitHub releases
- publish a JBang catalog
- install with one command

No cloning. No Maven required.

Full tutorial:
https://www.the-main-thread.com/p/ship-java-cli-jreleaser-jbang-github-release

#Java #JReleaser #JBang #Maven #OpenSource

@myfear
OK, this replaces Maven with requiring JBang, but you still need the right Java version and that's not that much easier. I would argue that publishing to something like Flathub would be a better option.

@infosec812 „Java is not required to be installed - JBang will automatically download a Java version
if no Java 8 or higher Java Development Kit (JDK) version is found.“

http://www.jbang.dev/download/

Download

JBang

@myfear Why a fat JAR? I don't agree with the use of these.

Firstly it's repackaging someone else's library -> what about licenses?

Secondly, the user doesn't know what the JAR contains. I prefer some kind of executable with the JAR and a libs directory containing all dependencies. This makes it clear what is being used.

Can that be done with jreleaser as well? I'm trying to build something likes this for my new tool https://github.com/eitch/LumineLog but also want to build a complete release as a zip.

@eitch @myfear yes, it can be done. JReleaser supports multiple distribution formats, FAT jar (or single jar) is but one of them. See https://jreleaser.org/guide/latest/concepts/distributions/index.html for reference
Distributions :: JReleaser

@aalmiray @myfear

I've gotten it to work quite well. A Windows and Linux distribution is built and they work. But what i can't get to work is adding JVM options. Can you point me in the right direction?

@eitch @myfear if the default templates are not good enough or something may be missing, you can always set your own templates. Review the documentation for a particular packager/assembler and use the `template` command to create the initial files, then edit at your own leisure
@eitch For those reasons I package my Java applications as a zip file and include a shell-script to run them. I use the maven assembly plugin to do so. Downsides, it is not as easy to learn to use as jReleaser and only does the packaging, not all the other things jReleaser does. However, it only requires maven and once you've done it for one project it is rather easy to move to other projects. If you are interested there is an example here: https://codeberg.org/darkstar/endgen/src/branch/main/endgen-dist
endgen

DSL of endpoint descriptions. This repository is a mirror.

Codeberg.org

@higgins I actually do this too. I found that really easy to do: Add a download for the #JRE and then a simple #maven assembly and one is good to go.

#jreleaser brings nice features i would like to try:
- auto releasing
- jlinking
- announcements
etc.

But i find jreleaser rather complicated. There is a lot of documentation, but not really when i want to do everything in Maven.

#java #programming

@eitch @higgins the JReleaser reference guide shows all configuration options using 5 different DSLs, Maven's XML being one of them. There's also plenty of examples found here https://jreleaser.org/guide/latest/examples/index.html

FWIW JReleaser's java-archive assembler provides behavior similar to Maven's appassambler + assembly plugins, plus a few extra features https://jreleaser.org/guide/latest/concepts/distributions/java-binary.html

Examples :: JReleaser