Package and Deploy JVM Applications with Capsule.
A capsule is a single executable JAR that contains everything your application needs to run either in the form of embedded files or as declarative metadata. More at capsule.io
Capsule integration is provided via Maven Profiles using the capsule-maven-plugin.
-
Write a
capsule.activatorfile inside thesrc/etcdirectory -
Open a console and type:
mvn clean package -
It builds a
[app-name]-capsule-fat.jarfile inside thetargetdirectory
It generates a fat capsule by default inside the target directory.
If you are a Gradle user, checkout the capsule gradle example.
The capsule Maven profile is activated by the presence of the src/etc/capsule.activator file (file content doesn't matter, just the file presence).
The integration provides the following defaults:
<properties>
<capsule.resolve>false</capsule.resolve>
<capsule.chmod>true</capsule.chmod>
<capsule.trampoline>false</capsule.trampoline>
<capsule.JVM-Args>-Xms512m -Xmx512m</capsule.JVM-Args>
<capsule.types>fat</capsule.types>
<capsule.caplets>Capsule</capsule.caplets>
</properties>For example, if you need or prefer a thin capsule, follow these steps:
- Open your
pom.xml - Go to the
<properties>section and add/set:
<properties>
<capsule.resolve>true</capsule.resolve>
<capsule.types>thin</capsule.types>
</properties>- Open a console and type:
mvn clean package
You'll find your thin capsule in the target directory.