Publish Asset Bundle with Maven
Developer approach to publishing
Observing the everyday activities of an Automation Engineer reveals a few facts:
- Developed Business Processes (BPs) are re-published about 20 times a day.
- An essential requirement is the possibility to invoke a published BP within CI tools.
It means that packing, building, and deploying an Asset Bundle should require minimal effort and time. Ideally, it should be automated. Automation also works well for CI cases.
Publish Asset Bundle with Maven
ODF includes workfusion-maven-plugin (bundle-maven-plugin for 10.1.0+). BP developers can use the tool to automate packing Asset Bundles and building RESTful POST requests to deploy the bundles to CT.
The Maven plugin is preconfigured in the pom.xml file of the bundle module in the archetype-generated project as shown below:
<!-- To import bundle to Control Tower execute "mvn bundle:import" -->
<plugin>
<groupId>com.workfusion.odf</groupId>
<artifactId>bundle-maven-plugin</artifactId>
<version>10.1.0.0</version>
<configuration>
<server>
<id>control-tower</id>
<url>${workfusion.environment.url}</url>
</server>
<bundle>target/${project.build.finalName}.zip</bundle>
</configuration>
</plugin>
Configure access to Control Tower
Before publishing Asset Bundles with the plugin, configure CT. For that, in your project generated with ODF archetypes, perform the following actions:
Specify the Control Tower URL where Asset Bundles are to be published. For that, modify the project's root
pom.xml:<workfusion.environment.url>https://lux-ct1.workfusion.com</workfusion.environment.url>You can also configure the URL when you start a project from an Archetype in the WorkFusion Studio wizard.
To specify the CT user credentials, modify
\[\~USER\_HOME\]/.m2/settings.xmlas shown below. Mind that the role set up for the user must have the Export/Import and Advanced Package Import permissions in CT. For details, refer to the Role management section.<!-- Credentials for Bundle Import API --> <server> <id>control-tower</id> <username>importapi</username> <password>notastandardpassword!1</password> </server>note
The
idvalue insettings.xmlmust be the same as theidvalue of the workfusion-maven-plugin (bundle-maven-plugin in 10.1+) server configuration inpom.xmlof the [ARTIFACT]-package module.
Deploy Asset Bundle to local Control Tower
workfusion-maven-plugin (bundle-maven-plugin for 10.1.0+) features a Maven goal enabling to publish an Asset Bundle to CT. Execute the goal from the [ARTIFACT]-package module of your project.
To deploy an Asset Bundle to a local Control Tower, follow the instructions below:
- Open the IA Cloud Developer's Launcher and start the Control Tower & WorkSpace group. Wait for the indicator to light up. This is essential to ensure Control Tower is launched since the service accepting and processing imported Asset Bundles starts with Control Tower.
- Run
mvn clean install. The command creates a bundle packed as a zip archive in the[ARTIFACT]-package/targetdirectory. - Run
mvn bundle:importforpom.xmllocated in the [ARTIFACT]-package module.
caution
Executing the mvn bundle:import command for the main pom.xml file in the root directory leads to the following error code: "No plugin found for prefix 'bundle' in the current project and the plugin groups".
Deploy Asset Bundle to server Control Tower
For instructions, refer to the following guides:
Validate publishing results
Always read the JSON response component-by-component to make sure all statuses are OK. Then, use one of the options below to validate that an Asset Bundle was published successfully to CT.
- Check that Import API did put BCB JAR into the target CT's Nexus. The BCB JAR is expected to appear in the
wf-machine-config-bundlerepository. - Validate re-publishing of a Business Process (BP) package:
- Build a package containing a BCB and publish it to Control Tower for the first time.
- Get bots created in Control Tower using WorkFusion Studio.
- Assemble a Business Process manually using the Bot Tasks created in WorkFusion Studio.
- Download the BP packaged as a zip file to your workstation.
- Copy the BP zip package into the
\[ARTIFACT\]-package/src/main/resources/business-processdirectory. - Make some changes to Bot Tasks (XML) and Java classes.
- Build a package containing the BCB and publish it to Control Tower for the second time.
- Check CT's Nexus. The BCB JAR must be re-deployed—that means, have a new timestamp.
- Go to Control Tower and check your Business Process. The Bot Tasks associated with the updated Java code must be updated automatically.