-
Task
-
Resolution: Done
-
Major
-
7.9.0.Final
-
None
-
2018 Week 39-41
-
NEW
-
NEW
When running Drools in a Fat JAR, for example created by the Maven Shade Plugin, the various "kie.conf" files of the Drools JARs (e.g. drools-core, drools-compiler) need to be merged, otherwise , the Fat JAR will contain only 1 kie.conf from a single dependency, resulting into errors.
This is for example required when running Drools in a Vert.x application.
You can merge resources in the Maven Shade Plugin using transformers, like this:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/kie.conf</resource>
</transformer>
For example, in my Vert.x app this is the full config of the Maven Shade Plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>${main.verticle}</Main-Verticle>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/kie.conf</resource>
</transformer>
</transformers>
<artifactSet>
</artifactSet>
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>