-
Notifications
You must be signed in to change notification settings - Fork 71
Uber JAR support
KumuluzEE (since version 2.4.0) provides support for packing and running microservices as uber JARs. It also includes a Maven plugin that correctly packages the microservice.
To package a KumuluzEE microservice into an uber JAR, you need to add the following plugin declaration into your REST module pom.xml:
<plugin>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-maven-plugin</artifactId>
<version>${kumuluzee.version}</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
-
kumuluzee:copy-dependencies
Copy dependencies and prepare for execution in an exploded class and dependency runtime.
-
kumuluzee:repackage
Repackages existing JAR archives so that they can be executed from the command line using
java -jar
.-
finalName
Final name of the generated "uber" JAR.
Default value is:
${project.build.finalName}
or${project.artifactId}-${project.version}
-
outputDirectory
Directory containing the generated JAR.
Default value is:
${project.build.directory}
-
-
kumuluzee:run
Run the application in an exploded class and dependency runtime.
If execution is not provided in kumuluzee-maven-plugin:
<plugin>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-maven-plugin</artifactId>
<version>${kumuluz.version}</version>
</plugin>
then you have to explicitly run
mvn kumuluzee:repackage
with desired goal after mvn package
to trigger the plugin.
Start the application using the following command:
java -jar ${project.build.finalName}.jar
Example:
java -jar my-app-1.0.0-SNAPSHOT.jar
or by using the run
goal of the KumuluzEE maven plugin.
To package a KumuluzEE microservice as exploded, you can use the following configuration of the plugin in REST module pom.xml:
<plugin>
<groupId>com.kumuluz.ee</groupId>
<artifactId>kumuluzee-maven-plugin</artifactId>
<version>${kumuluz.version}</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
Start the application packaged as exploded using the following command:
java -cp target/classes:target/dependency/* com.kumuluz.ee.EeApplication
in Windows environment use the command:
java -cp target/classes;target/dependency/* com.kumuluz.ee.EeApplication