Chapter 6. Creating a self-contained Red Hat Decision Manager Spring Boot JAR file


You can create a self-contained Red Hat Decision Manager Spring Boot JAR file that contains multiple versions of the same KJAR file, including modules. These are files that have the same artifactID and groupID attribute values, but have different version values. The KJAR files are separated from the BOOT-INF/lib JAR files to avoid class loader collisions. Each KJAR classpath container file is isolated from other KJAR classpath container files and does not rely on the Spring Boot class loader.

Prerequisites

  • You have a Red Hat Decision Manager Spring Boot project.

Procedure

  1. Add the following properties to your Spring Boot application application.properties file:

    kieserver.classPathContainer=true
    kieserver.autoScanDeployments=true
    Expand
    ParameterValuesDescription

    kieserver.classPathContainer

    true, false

    When set to true, KIE Server uses the class loader used by the container to load KJAR files and their dependencies.

    kieserver.autoScanDeployments

    true, false

    When set to true, KIE Server scans and deploys all KJAR files available in the Spring Boot application, whether they are declared programmatically or through the Maven plug-in.

    When both of these properties are set to true, the Spring Boot KIE Server automatically scans for deployable artifacts that are packaged within the Spring Boot application using the package-dependencies-kjar Maven goal of the kie-maven-plugin plug-in.

  2. Add the following Maven plug-in in the Spring Boot service/pom.xml file where <GROUP_ID>, <ARTIFACT_ID>, and <VERSION> are the group, artifact, and version (GAV) of an artifact that your project uses. These artifacts are located in the Spring Boot project kjar/pom.xml file.

    Note

    You can add more than one version of an artifact.

      <build>
        <plugins>
          <plugin>
            <groupId>org.kie</groupId>
            <artifactId>kie-maven-plugin</artifactId>
            <version>${version.org.kie}</version>
            <executions>
              <execution>
                <id>copy</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>package-dependencies-kjar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId><GROUP_ID></groupId>
                  <artifactId><ARTIFACT_ID>/artifactId>
                  <version><VERSION></version>
                </artifactItem>
              </artifactItems>
            </configuration>
          </plugin>
        <plugins>
      <build>

    The artifacts required to run the KJAR will be resolved at build time.

    The following example adds two version of the Evaluation artifact:

      <build>
        <plugins>
          <plugin>
            <groupId>org.kie</groupId>
            <artifactId>kie-maven-plugin</artifactId>
            <version>${version.org.kie}</version>
            <executions>
              <execution>
                <id>copy</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>package-dependencies-kjar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.myspace</groupId>
                  <artifactId>Evaluation</artifactId>
                  <version>1.0.0-SNAPSHOT</version>
                </artifactItem>
                <artifactItem>
                  <groupId>com.myspace</groupId>
                  <artifactId>Evaluation</artifactId>
                  <version>2.0.0-SNAPSHOT</version>
                </artifactItem>
              </artifactItems>
            </configuration>
          </plugin>
        <plugins>
      <build>
  3. To build the self-contained Spring Boot image, enter the following command in the service directory:

    maven install
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top