Publish bundle with Maven
Developer approach to publishing
Observing everyday activities of Automation Engineer reveals a few facts.
- It is required to re-publish the actively developed Business Process about 20 times a day.
- An important requirement to publish is a possibility to invoke it within CI tools.
It means that the time a person spends on packing a bundle and calling REST Import API should be minimal, i.e., ideally automated. Automation also works well for CI cases.
Publish bundle with Maven
Having the Maven build tool for BCB and ODF, we have leveraged it for publishing as well. The ODF team provides workfusion-maven-plugin (bundle-maven-plugin for 10.1.0+) which encapsulates construction of the RESTful POST request. Publish Maven plugin pre-configured in the bundle module's pom.xml of the archetype-generated project as:
v9.3.4
For v9.3.4, ODF introduces Maven Profiles to provide ability to deploy a bundle both to local and remote Control Towers.
<!-- To import bundle to local Control Tower execute "mvn bundle:import" -->
<!-- To import bundle to remote server Control Tower execute "mvn clean install -Premote" and then "mvn bundle:import -Premote" -->
<plugin>
<groupId>com.workfusion.odf</groupId>
<artifactId>bundle-maven-plugin</artifactId>
<version>9.3.0.0</version>
<configuration>
<server>
<id>${workfusion.server.id}</id>
<url>${workfusion.environment.url}/workfusion</url>
</server>
<bundle>target/${project.build.finalName}.zip</bundle>
</configuration>
</plugin>
v9.2.2
<!-- To deploy bundle to ControlTower execute "mvn workfusion:publish" -->
<plugin>
<groupId>com.codehaus.mojo</groupId>
<artifactId>workfusion-maven-plugin</artifactId>
<configuration>
<server>
<id>control-tower</id>
<url>${workfusion.environment.url}/workfusion/</url>
</server>
</configuration>
</plugin>
Control Tower access for publish
Some configuration required before publishing Maven goal can be executed. In the project generated using ODF archetypes, perform the following actions.
Specify Control Tower URL where BP bundle will be published. For that, modify your project root pom.xml:
<workfusion.environment.url>https://lux-ct1.workfusion.com</workfusion.environment.url>Also, this URL can be configured when you start project from Archetype in the WorkFusion Studio wizard.
Specify Control Tower user credentials. For that, modify your [~USER_HOME]/.m2/settings.xml to include:
<!-- Credentials for Bundle Import API --> <server> <id>control-tower</id> <username>importapi</username> <password>notastandardpassword!1</password> </server>
tip
Mind that this user role must have the Export/Import and Advanced Package Import permissions.
note
id in settings.xml should be the same as id of workfusion-maven-plugin (bundle-maven-plugin in 10.1+) server configuration in [ARTIFACT]-package module's pom.xml.
Maven goal to publish
Provided by ODF, workfusion-maven-plugin (bundle-maven-plugin in 10.1.0+) introduces a new Maven goal to publish. Make sure you execute this goal from the [ARTIFACT]-package module of your project.
v9.3.4
Use mvn clean install -Premote and then mvn bundle:import -Premote.
v9.2.2
mvn workfusion:publish
Validate publishing results
Here are possible options on how to validate successful package publishing.
Make sure to always read response JSON component-by-component to make sure all the statuses are OK.
- Validate that Import API did put BCB JAR into the target Control Tower Nexus. It should appear in the wf-machine-config-bundle repository.
- Validate re-publishing of the Business Process package.
- Build the package containing BCB and publish it to Control Tower for the first time.
- Get Bots created in Studio within Control Tower.
- Assemble Business Process manually using Bot Tasks created in Studio.
- Export the Business Process package as .zip, i.e., download it into your workstation.
- Copy the .zip BP package into the [ARTIFACT]-package/src/main/resources/business-process folder.
- Introduce some changes to Bot Tasks (.xml) and Java classes.
- Build the package containing BCB and publish it to Control Tower for the second time.
- Check Control Tower Nexus---BCB JAR must be re-deployed, i.e., have a new timestamp.
- Navigate to Control Tower and look at your Business Process. It should have automatically updated Bot Tasks where the updated Java code should be linked.