Over a million developers have joined DZone.

Top 3 Ways Developers Build Projects Against JBoss BPM Suite

DZone 's Guide to

Top 3 Ways Developers Build Projects Against JBoss BPM Suite

· Java Zone ·
Free Resource

In this weeks tips & tricks series we introduce some of the more technical aspects of working with JBoss BRMS and JBoss BPM Suite products by showing you the top three ways that you as a developer can build your projects against  projects that the business users create with JBoss BPM Suite (or JBoss BRMS). 

The developer in all of us is not always interested in staying within the confines of the beautiful  Business Central web dashboard as provided, but is working from our favorite IDE to build the applications that leverage the work from our business user.

We expect to clone the project the business user created and build it from scratch, or we want to embed this a project dependency and run our project against the product artifacts available to us in the JBoss central maven repositories.

We also might not trust our business users and want to create, run, and analyse some unit tests to confirm that this stuff we depend on is working properly.

All these actions rely on us understanding what product artifacts we need, how the business user projects build within their product dashboard, and how to build them outside of the product when we clone these projects.

For this article, we will be using the  Customer Evaluation Demo project as our running example, where you can find the various aspects of this in the  project hosted on github.com.

1. Depending on Business Central projects

When business users login and create a project with rules, event, and/or processes it results in a  Knowledge JAR (KJAR) after they build it. This KJAR is just a Maven artifact JAR file that is put into the local repository by default but can be configured to point to any valid Maven repository. 

As a developer you want to use this as a dependency in your project, so how does this work?

We need to point to our development project's pom.xml file at the proper business user project that will be built from the JBoss BPM Suite, using the Customer Evaluation demo project. If you look into that project you will find a pom.xml that does just that:  bpms-customer-evaluation-demo/projects/customer-evaluation-demo/pom.xml.

Locate the code snippet from the pom.xml below to see how the project is added to your development projects dependencies.
# Add this to your development projects pom.xml file as shown to depend on the 
# customer evaluation project build version 1.0.
<!-- KJar file from project. -->

Next up we look at how you can add the central JBoss maven repository and make use of the latest JBoss BPM Suite product dependencies.

2. JBoss BPM Suite Maven dependencies

The JBoss maven repository is used as shown below which will point to the latest product version we want to use, at the time of this writing it was JBoss BPM Suite 6.0.2:
# Add this to your pom.xml as shown, or modify (exercise left to the reader)
# to add into your .m2/settings.xml file. 
    <name>JBoss Maven Repository</name>

Next we want to setup a unit test that will exercise our rules, events, and process project. 

You can find this in the Customer Evaluation demo project setup with maven dependencies using a central pom.xml property to point to the artifact version we are currently using. Next we need a product dependency to unit test our code.
# Add this to your pom.xml as shown, or modify (exercise left to the reader)
# to add into your .m2/settings.xml file. 
    <name>JBoss Maven Repository</name>

Business Central project pom file.
Next up and the final section, how to build business user projects as they are cloned directly from the JBoss BPM Suite product's internal git repository.

3. Building projects outside Business Central

Once you have a business user project completed as shown above with the Customer Evaluation demo, you want to  clone this over SSH following this previous article (link)

# Cloning the business users customer evaluation demo project from the 
# command line.
$ git clone ssh://erics@localhost:8001/customer
Cloning into 'customer'...
The authenticity of host '[localhost]:8001 ([]:8001)' can't be established.
DSA key fingerprint is ef:51:d6:ec:7f:ce:8b:e1:b6:a1:96:5e:6a:cf:d3:f8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:8001' (DSA) to the list of known hosts.
Password authentication

remote: Counting objects: 602, done
remote: Finding sources: 100% (602/602)
remote: Getting sizes: 100% (466/466)
remote: Compressing objects: 100% (118792/118792)
remote: Total 602 (delta 24), reused 72 (delta 21)
Receiving objects: 100% (602/602), 60.23 KiB, done.
Resolving deltas: 100% (344/344), done.

$ cd customer/evaluation/
$ ls -l
total 16
drwxr-xr-x  32 erics  501  1088 Aug 13 17:36 global
-rw-r--r--   1 erics  501   990 Aug 13 17:36 pom.xml
-rw-r--r--   1 erics  501    97 Aug 13 17:36 project.imports
drwxr-xr-x   4 erics  501   136 Aug 13 17:36 src

# When we try to build it breaks on the strange kie-maven-plugin
# found in the pom.xml.
$ mvn install
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/kie/kie-maven-plugin/6.0.3-redhat-4/kie-maven-plugin-6.0.3-redhat-4.pom
[WARNING] The POM for org.kie:kie-maven-plugin:jar:6.0.3-redhat-4 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/org/kie/kie-maven-plugin/6.0.3-redhat-4/kie-maven-plugin-6.0.3-redhat-4.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar (165 KB at 148.8 KB/sec)
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   The project customer:evaluation:1.0 (/Users/erics/demo-projects/bpms6/bpms-customer-evaluation-demo/support/customer/evaluation/pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.kie:kie-maven-plugin:6.0.3-redhat-4 or one of its dependencies could not be resolved: Could not find artifact org.kie:kie-maven-plugin:jar:6.0.3-redhat-4 in central (http://repo.maven.apache.org/maven2) -> [Help 2]
[ERROR]     Unknown packaging: kjar @ line 8, column 14
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

Once cloned you will notice that the project will not build locally due to missing dependencies that the kie-maven-plugin needs. If you add them locally to the pom.xml it will build locally but these are managed internally to the product when the business user builds from within business central.

It is suggested to not push these changes back into the repository, but to only use them externally. Once you do this and add the JBoss maven repository, it will build outside of the business central GUI tooling.

01 # Add repositories and plugins for maven central to the pom.xml.
02 #
03 <repositories>
04 <repository>
05 <id>jboss-maven-repository</id>
06 <name>JBoss Maven Repository</name>
08 <layout>default</layout>
09 <releases>
10 <enabled>true</enabled>
11 <updatePolicy>never</updatePolicy>
12 </releases>
13 <snapshots>
14 <enabled>false</enabled>
15 <updatePolicy>never</updatePolicy>
16 </snapshots>
17 </repository>
18 </repositories>
19 <pluginRepositories>
20 <pluginRepository>
21 <id>jboss-maven-repository</id>
22 <name>JBoss Maven Repository</name>
24 <layout>default</layout>
25 <releases>
26 <enabled>true</enabled>
27 <updatePolicy>never</updatePolicy>
28 </releases>
29 <snapshots>
30 <enabled>false</enabled>
31 <updatePolicy>never</updatePolicy>
32 </snapshots>
33 </pluginRepository>
34 </pluginRepositories>
36 # Add the dependencies needed.
37 #
38 <dependencies>
39 <dependency>
40 <groupId>org.kie</groupId>
41 <artifactId>kie-api</artifactId>
42 <version>6.0.3-redhat-4</version>
43 <scope>provided</scope>
44 </dependency>
45 <dependency>
46 <groupId>org.jbpm</groupId>
47 <artifactId>jbpm-bpmn2</artifactId>
48 <version>6.0.3-redhat-4</version>
49 <scope>provided</scope>
50 </dependency>
51 </dependencies>
53 # Now you can build it in your IDE.
54 #
55 $ mvn package
56 [INFO] Scanning for projects...
57 [INFO
58 [INFO] ------------------------------------------------------------------------
59 [INFO] Building customer-evaluation 1.0
60 [INFO] ------------------------------------------------------------------------
61 [INFO]
62 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ evaluation ---
63 [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
64 [INFO] Copying 11 resources
65 [INFO]
66 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ evaluation ---
67 [INFO] Changes detected - recompiling the module!
68 [WARNINGFile encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
69 [INFO] Compiling 2 source files to /Users/erics/demo-projects/bpms6/bpms-customer-evaluation-demo/support/customer/evaluation/target/classes
70 [INFO]
71 [INFO] --- kie-maven-plugin:6.0.3-redhat-4:build (default-build) @ evaluation ---
72 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
73 SLF4J: Defaulting to no-operation (NOP) logger implementation
74 SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
75 [INFO] KieModule successfully built!
76 [INFO]
77 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ evaluation ---
78 [INFO] Nothing to compile - all classes are up to date
79 [INFO]
80 [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ evaluation ---
81 [INFO] No tests to run.
82 [INFO]
83 [INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ evaluation ---
84 [INFO] Building jar: /Users/erics/demo-projects/bpms6/bpms-customer-evaluation-demo/support/customer/evaluation/target/evaluation-1.0.jar
85 [INFO] ------------------------------------------------------------------------
87 [INFO] ------------------------------------------------------------------------
88 [INFO] Total time: 7.086s
89 [INFO] Finished at: Wed Aug 13 17:56:33 CEST 2014
90 [INFO] Final Memory: 36M/447M
91 [INFO] ------------------------------------------------------------------------

Hopefully this will get you started when you are attempting to integrate your development project with the various possibilities offered by the JBoss BPM Suite (and JBoss BRMS) product.

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}