Class ApplicationBuilder

All Implemented Interfaces:
Generator, Renamable, ResourceProvider, ResourceRetriever

The ApplicationBuilder generates application distributions as resources of type ApplicationZipFile or ApplicationTarFile.

Both resource types represent runnable application distributions consisting of classpath resources and a generated start script that launches the application.

The application can be configured using methods that control:

  • the output directory for the generated distribution,
  • the base name of the generated archive file,
  • the executable (start script) name,
  • the main class to execute (mandatory),
  • and the JVM options required by the application and included in the generated start script.

Method add(Stream) is used to specify the classpath resources to be included in the generated distribution and added to the classpath when running the application. In addition, the application builder adds the resources obtained from the providers specified with addFrom(Stream), using a request for resources of type LibraryJarFile with all intents.

Special handling is provided for resources of type MvnRepoJarFile. For these resources the associated MvnRepoResource information is collected first. The collected coordinates are then used to resolve the corresponding jar files from the Maven repository. The resolved JAR files are then added to the generated distribution. This prevents different versions of the same library to be included in the distribution.

A request for Cleanliness removes any generated distribution archives from the configured destination directory.