Creating maven projects that can be imported into Red Hat Business Central

Use the KIE KJAR Archetype to build new KIE KJAR which can be imported into the Workbench

Jeffrey Taylor
3 min readSep 25, 2020

Avoid: “There are no projects available to import. Check the URL, the credentials, and if there’s a master branch in the repository.” This is the error that we are trying to avoid:

You will need to know the mapping between BPMS, RHPAM and jBPM. For this article, we will use Enterprise version RHPAM 7.8 which maps to Community (jBPM) version 7.39.x.

Set up:

sudo dnf install java-11-openjdk-devel
sudo dnf install maven

Use the Red Hat GA repository. If you are behind a firewall, you can add the maven repo code from the Red Hat Process Automation Manager Downloads to your internal maven server, for example, for 7.8, Maven Repository (2 GB). If you are not behind a restrictive firewall, you can use this ~/.m2/settings.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<profiles>
<profile>
<id>redhat-ga-repository</id>
<repositories>
<repository>
<id>redhat-ga-repository</id>
<name>Red Hat GA repository</name>
<url>http://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-ga-repository</id>
<name>Red Hat GA repository</name>
<url>http://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>redhat-ga-repository</activeProfile>
</activeProfiles>
</settings>

Build the KIE KJAR Archetype

git clone git@github.com:kiegroup/droolsjbpm-knowledge.git
cd droolsjbpm-knowledge/
git checkout 7.39.x
mvn clean install

Expect a message similar to:

Installing /home/user/droolsjbpm-knowledge/kie-archetypes/pom.xml to /home/user/.m2/repository/org/kie/kie-archetypes/7.39.1-SNAPSHOT/kie-archetypes-7.39.1-SNAPSHOT.pom

Create a new project:

cd ~/my-project-foldermvn archetype:generate \
-DarchetypeGroupId=org.kie \
-DarchetypeArtifactId=kie-kjar-archetype \
-DarchetypeVersion=7.39.0.Final-redhat-00005

Build the new project:

cd mybusinessapp/ 
mvn clean install

Create a .gitignore:

.vscode/
*.class
*.jar
*.war
*.ear
*.logs
*.iml
.eclipse
.settings
.classpath
/bin/

Create a target project repo, for example https://github.com/jtayl222/KJAR-Base-project

echo “# KJAR-Base-project” >> README.md
git init
git add .
git commit -m “first commit”
git branch -M master
git remote add origin git@github.com:jtayl222/KJAR-Base-project.git
git push -u origin master

The tree should now look something like this:

$ tree -L 2 -a
.
├── .git
│ ├── branches
│ ├── COMMIT_EDITMSG
│ ├── config
│ ├── description
│ ├── HEAD
│ ├── hooks
│ ├── index
│ ├── info
│ ├── logs
│ ├── objects
│ └── refs
├── .gitignore
├── global
│ ├── customeditors.json
│ ├── defaultemailicon.gif
│ ├── defaultlogicon.gif
│ ├── defaultmilestoneicon.png
│ ├── defaultservicenodeicon.png
│ ├── defaultsubcaseicon.png
│ ├── patterns.json
│ └── themes.json
├── pom.xml
├── project.imports
├── project.repositories
├── readme.md
├── README.md
├── src
│ ├── main
│ └── test
└── target
├── classes
├── generated-sources
├── generated-test-sources
├── maven-archiver
├── maven-status
├── mybusinessapp-1.0.jar
└── test-classes
18 directories, 20 files

You should now be able to import the project:

In addition to importing this project from the git repo into Business Central, the maven project in the mybusinessapp folder can be imported into CodeReadyStudio.

As a follow on, you may want to Create post-commit Git hooks.

--

--