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 id value in settings.xml must be the same as the id value of the workfusion-maven-plugin (bundle-maven-plugin in 10.1+) server configuration in pom.xml of 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:
- Make sure you launched your workstation's Control Tower because the service that accepts and processes Asset Bundles starts with Control Tower. For that, open WorkFusion Studio IDE and enable components. Wait for the Control Tower indicator to light up.
- 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
Similar to the local CT deployment flow, Asset Bundles are published to a server CT with Maven goals executed from the [ARTIFACT]-package module of your project.
To proceed with the deployment, execute the commands below:
- For a clean install, run
mvn clean install. The command creates a bundle packed as a zip archive in the[ARTIFACT]-package/targetdirectory. - Import a bundle to the server Control Tower with
mvn bundle:import -Premote.
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 BP 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.