NB: the TIBCO BusinessWorks projects to review are considered to be mavenized by BWMaven. They must have a bw-ear or projlib Maven packaging.

Simple Code Review

A simple code review outputs in HTML format in “target/review” directory.

Adding Code Review Dependencies

To enable the Code Review on a TIBCO BusinessWorks project, simply add this snippet in the POM of the project:

<dependencies>
  <dependency>
    <groupId>fr.fastconnect.factory.tibco.bw.codereview</groupId>
    <artifactId>code-review-resources</artifactId>
    <version>2.0.0</version>
    <type>zip</type>
    <classifier>display</classifier>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>fr.fastconnect.factory.tibco.bw.codereview</groupId>
    <artifactId>code-review-rules-basic</artifactId>
    <version>2.0.0</version>
    <type>zip</type>
    <classifier>bw</classifier>
    <scope>test</scope>
  </dependency>
</dependencies>

NB: these dependencies are added in the test scope which means they won’t be processed for compilation of EAR and Projlib nor be included in any final build. They are only used to perform the Code Reviews.

Launching a Code Review

Then, launch this command:

mvn clean code-review:code-review



The code-review-resources artifact is used to copy display resources such as CSS or JavaScript files.





The code-review-rules-basic artifact contains the rules to execute in the review.

Code Review in Sonarqube

The Code Review results can be imported directly into Sonarqube. The 5.1 version is known to be compatible and is the recommended version.

The import is done by the Code Review Sonar plugin which is a standard Sonarqube plugin. This plugin will parse the XML output (make sure to enable XML format) and convert Code Review results into Sonarqube issues.

Adding the plugin in Sonarqube

First the Code Review Sonar plugin must be copied in the Sonarqube plugins directory:

mvn dependency:copy \
-Dartifact=fr.fastconnect.factory.tibco.bw.codereview:code-review-sonar-plugin:2.0.0:jar \
-DoutputDirectory=$SONARQUBE_HOME/extensions/plugins

Launching a Code Review (with Sonar)

Then, launch this command:

mvn clean code-review:code-review sonar:sonar

Code Review with custom rules

It is possible to use several set of rules including the built-in one and custom ones.

Creating the custom rules

The custom rules project is a TIBCO BusinessWorks project created with a Maven archetype (artifactId will be automatically prefixed by mandatory “code-review-” prefix):

mvn archetype:generate
    -DarchetypeGroupId=fr.fastconnect.factory.tibco.bw.codereview \
    -DarchetypeArtifactId=archetype-new-rules \
    -DgroupId=com.company.rules \
    -DartifactId=rules-custom
    -DcodeReviewVersion=2.0.0

This will create a TIBCO BusinessWorks Projlib project which can be edited to add custom rules following the provided model:

mvn bw:launch-designer

When rules are ready, the project has to be installed or deployed:

mvn clean install

Then, it can be added as a Code Review rules dependency:

  <dependency>
    <groupId>com.company.rules</groupId>
    <artifactId>code-review-rules-custom</artifactId>
    <version>1.0.0</version>
    <type>zip</type>
    <classifier>bw</classifier>
    <scope>test</scope>
  </dependency>

Updating Sonarqube configuration

When using custom rules along with Sonarqube, it is mandatory to update Sonarqube configuration with this command run on a project with the custom rules:

mvn clean code-review:generate-sonar-rules

This will output a “rules.xml” file:

[INFO] --- code-review-plugin:2.0.0:generate-sonar-rules (default-cli) ---
[INFO] Sonar rules saved to .../target/review/rules.xml

This “rules.xml” file must be copied in $SONARQUBE_HOME/conf before restarting Sonarqube to take the custom rules into account.

It might be useful to “Restore Built-in Profiles” of “BW profile” in the Sonarqube administration interface.

Back to top

Version: 2.0.0. Last Published: 2015-09-03.