Maven 3 Java 1.8
In my pom.xml
<dependencies>
<dependency>
<groupId>com.myproject/groupId>
<artifactId>mixed-pojo</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/external-pojo-1.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.3.1</version>
</dependency>
...
I need to create ONE executable jar. So I use plugin maven-shade-plugin
here pom's snippet:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myproject.AppStarterKt</mainClass>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>${project.basedir}/libs/external-pojo-1.0-SNAPSHOT.jar</include>
<include>com.zaxxer:HikariCP</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
As result it generate executable jar
:
myproject-1.0-SNAPSHOT-shaded.jar
Nice. But the problem is that I need manually add ALL dependencies in plugin like this:
<artifactSet>
<includes>
<include>${project.basedir}/libs/external-pojo-1.0-SNAPSHOT.jar</include>
<include>com.zaxxer:HikariCP</include>
</includes>
</artifactSet>
But I has 50 dependencies. How add ALL dependencies to executable jar?
P.S.
external-pojo-1.0-SNAPSHOT.jar
is a external custom jar that locate on project's folder /libs