Skip to content

Commit

Permalink
Replace one-jar plugin with maven-shade plugin for standaalone uber j…
Browse files Browse the repository at this point in the history
…ar packaging
  • Loading branch information
Tuncay NAMLI committed Nov 12, 2021
1 parent 93c21ed commit 352276c
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 43 deletions.
50 changes: 40 additions & 10 deletions onfhir-server-r4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,53 @@
</archive>
</configuration>
</plugin>
<!--Generate standalone executable jar-->
<!-- Generates an executable uber-jar with Maven, containing all dependencies. -->
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<configuration>
<filename>onfhir-server-standalone.jar</filename>
<mainClass>io.onfhir.r4.Boot</mainClass>
<attachToBuild>false</attachToBuild>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>one-jar</goal>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/log4j-provider.properties</exclude>
</excludes>
</filter>
</filters>
<finalName>onfhir-server-standalone</finalName>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.onfhir.r4.Boot</mainClass>
</transformer>

<!-- Append application.conf to jar configurations-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>application.conf</resource>
</transformer>

<!-- Append reference.conf to jar configurations for Akka to run -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
Expand All @@ -60,7 +90,7 @@
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<!-- Put the standalone jar since it will be run by Docker engine -->
<include>onfhir-standalone.jar</include>
<include>onfhir-server-standalone.jar</include>
</resource>
</resources>
</configuration>
Expand Down
49 changes: 39 additions & 10 deletions onfhir-server-r5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,49 @@
</archive>
</configuration>
</plugin>
<!--Generate standalone executable jar-->
<!-- Generates an executable uber-jar with Maven, containing all dependencies. -->
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<configuration>
<filename>onfhir-server-standalone.jar</filename>
<mainClass>io.onfhir.r5.Boot</mainClass>
<attachToBuild>true</attachToBuild>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>one-jar</goal>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/log4j-provider.properties</exclude>
</excludes>
</filter>
</filters>
<finalName>onfhir-server-standalone</finalName>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.onfhir.r5.Boot</mainClass>
</transformer>

<!-- Append application.conf to jar configurations-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>application.conf</resource>
</transformer>

<!-- Append reference.conf to jar configurations for Akka to run -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -60,7 +89,7 @@
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<!-- Put the standalone jar since it will be run by Docker engine -->
<include>onfhir-standalone.jar</include>
<include>onfhir-server-standalone.jar</include>
</resource>
</resources>
</configuration>
Expand Down
47 changes: 38 additions & 9 deletions onfhir-server-stu3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,47 @@
</plugin>
<!--Generate standalone executable jar-->
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<configuration>
<filename>onfhir-server-standalone.jar</filename>
<mainClass>io.onfhir.stu3.Boot</mainClass>
<attachToBuild>false</attachToBuild>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>one-jar</goal>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/log4j-provider.properties</exclude>
</excludes>
</filter>
</filters>
<finalName>onfhir-server-standalone</finalName>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.onfhir.stu3.Boot</mainClass>
</transformer>

<!-- Append application.conf to jar configurations-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>application.conf</resource>
</transformer>

<!-- Append reference.conf to jar configurations for Akka to run -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -59,7 +88,7 @@
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<!-- Put the standalone jar since it will be run by Docker engine -->
<include>onfhir-standalone.jar</include>
<include>onfhir-server-standalone.jar</include>
</resource>
</resources>
</configuration>
Expand Down
18 changes: 4 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<!-- plugin versions -->
<scala.maven.plugin.version>4.1.1</scala.maven.plugin.version>
<jar.plugin.version>3.1.0</jar.plugin.version>
<onejar.plugin.version>1.4.4</onejar.plugin.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<surefire.plugin.version>2.19.1</surefire.plugin.version>
<spotify.docker.plugin.version>0.4.3</spotify.docker.plugin.version>

Expand Down Expand Up @@ -173,19 +173,9 @@
<version>${jar.plugin.version}</version>
</plugin>
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>${onejar.plugin.version}</version>
<executions>
<execution>
<configuration>
<filename>onfhir-standalone.jar</filename>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit 352276c

Please sign in to comment.