Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-2839

Document how to run Drools with a flat classpath by merging kie.conf files

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 7.13.0.Final
    • 7.9.0.Final
    • docs
    • 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>
      

              mfusco@redhat.com Mario Fusco
              rhn-gps-ddoyle Duncan Doyle (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: