Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create executable JAR with Gradle? [duplicate]

How to create executable JAR with gradle?

By executable I mean JAR should run and run well, not run and then crash with unresolved dependencies.

Also I need 1-2 Gradle-style line solution, not dozen lines groovy code, collecting dependencies, generated by some unknown plugins.

Also, solution should work out of the box. No any complex configuration applicable.

I have tried plugin: "edu.sc.seis.launch4j" and it didn't work.

like image 756
Dims Avatar asked Apr 30 '26 19:04

Dims


1 Answers

Basically there are two possibilities:

  1. Application plugin, provided by gradle. Basically it prepares jar and a handful of scripts to run it.
  2. Shadow plugin which prepares an uberjar, a runnable, repackaged artifact with all the dependencies required.
like image 71
Opal Avatar answered May 03 '26 10:05

Opal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!