79315805

Date: 2024-12-29 14:57:53
Score: 3
Natty:
Report link

Dependencies inside a .jar file

I know you asked specifically for this:

Can anyone please provide me the documentation link and possibly an answer on how can I include dependencies inside ".jar"?

And while you can do this, see the answer from Uros, you have a few drawbacks:

Actual goal of your question

Clearly you want to create a distribution? Let me show yo ua few more options.

Default layout with script

Instead, please consider the approach taken in the JReleaser plugin, which can create a template-based script (script.cmd for Windows and just 'script' for unix/linux systems):

https://jreleaser.org/guide/latest/reference/assemble/java-archive.html

Using the dependency plugin, you just assemble all dependencies into a lib folder and then run the jreleaser goal. You will have such a directory layout:

myapp-1.0.0
|- bin
|  |- myapp.cmd
|  `- myapp(.sh)
`- lib
   |- logback.jar
   `- slf4j.jar

(just a simple example).

Additionally, this plugin creates a .zip or .tar.gz file which can be attached to your project as an artifact.

Reasons:
  • Blacklisted phrase (0.5): how can I
  • Blacklisted phrase (1): this plugin
  • RegEx Blacklisted phrase (2.5): Can anyone please provide me
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
Posted by: Benjamin Marwell