[jboss-jira] [JBoss JIRA] (DROOLS-2839) Document how to run Drools with a flat classpath by merging kie.conf files

Duncan Doyle (JIRA) issues at jboss.org
Mon Aug 6 11:45:00 EDT 2018


Duncan Doyle created DROOLS-2839:
------------------------------------

             Summary: Document how to run Drools with a flat classpath by merging kie.conf files
                 Key: DROOLS-2839
                 URL: https://issues.jboss.org/browse/DROOLS-2839
             Project: Drools
          Issue Type: Bug
          Components: docs
    Affects Versions: 7.9.0.Final
            Reporter: Duncan Doyle
            Assignee: Mario Fusco


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:
{code}
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
    <resource>META-INF/kie.conf</resource>
</transformer>
{code}

For example, in my Vert.x app this is the full config of the Maven Shade Plugin:
{code}
<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>
{code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list