Adding external library to artifact jar in IntelliJ IDEA

You have 2 options here:

  • extract the dependency into the artifact jar so that the app is the single executable jar with all the dependencies
  • link the dependent jars via the Manifest.MF and copy them near the application main jar

I’ve prepared a sample project that demonstrates both approaches: HelloWithDependencies.zip.

The artifacts are produced into out\single and out\linked directories.

Relevant configurations:

single

linked

Leave a Comment