Gradle - Distribution Plugin

About

A page about the Distribution plugin that creates zip or tar archive and is mostly used in combination with the application plugin

Natively, gradle (7) does not support the bundle of a native runtime image, see this page on how to do it in pure gradle script: How to bundle a jvm in a Gradle application targeting Windows, Linux or Macos

How to manage the creation or not of Root Directory in the created archive

Without root directory

If you don't want any root directory, use a absolute path

Example if you want to copy all runtime jar into the lib directory of the archive.

into("/lib") { // the `/` make it absolute
   from(configurations.runtimeClasspath)
}

With a root directory

If you want a root directory, use a relative path

Example if you want to copy all runtime jar into the archiveName/lib directory of the archive.

into("lib") { // because you don't have the root separator `/` as first character, this is a relative path
   from(configurations.runtimeClasspath)
}

Documentation / Reference





Discover More
How to bundle a jvm in a Gradle application targeting Windows, Linux or Macos

The gradle application plugin does not give the possibility to embed a jvm. This page shows how to do with a minimal knowledge of Gradle code



Share this page:
Follow us:
Task Runner