Skip to main content
Version: 10.2.9

Explore package module structure

What is Assembly?

The ODF 2 Simple Archetype uses the standard Maven Assembly plugin for packaging all required resources into the WorkFusion Bundle.

The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive containing dependencies, modules, site documentation, and other files.

Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors. The descriptors handle many common operations, such as packaging a project's artifact along with generated documentation into a single zip archive. Alternatively, your project can provide its own descriptor and assume a much higher level of control over how dependencies, modules, file-sets, and individual files are packaged in the assembly.

An "assembly" is a group of files, directories, and dependencies assembled into an archive format and distributed. For example, assume that a Maven project defines a single zip artifact that contains both a console application and a Swing application. A project like this can define two "assemblies" that bundle the application with different supporting scripts and dependency sets. One assembly is the assembly for the console application, while the other one can be a Swing application bundled with a slightly different set of dependencies.

The Assembly Plugin provides a descriptor format that defines an arbitrary assembly of files and directories from a project. For example, if your Maven project contains the src/main/bin directory, you can instruct the Assembly Plugin to copy this directory contents to the assembly bin directory and to change the permissions of the files in the bin directory to the UNIX mode 755. The parameters to configure this behavior are supplied to the Assembly Plugin using the assembly descriptor.

Project structure

The Simple Archetype generates a Maven project that contains the following Maven modules:

  • [UC_CODE]-bcb contains source code of the AI Agent Bot Tasks and related Java code.
  • [UC_CODE]-package defines the Bundle structure and uses the Maven Assembly plugin to actually build it.
  • [UC_CODE]-test contains integration and acceptance tests for the project Bundle.

Package module

Inside the Package module, there are initially two folders: assembly and src. After each project build, the target folder is generated and contains a resulting Bundle artifact, compiled classes, settings, and resources. In assembly, there is a package.xml file, which is a descriptor for dynamic resource copying. This file has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>wfar</id>

<includeBaseDirectory>false</includeBaseDirectory>

<formats>
<format>zip</format>
</formats>

<fileSets>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory/>
</fileSet>
</fileSets>

<dependencySets>
<dependencySet>
<outputDirectory>artifactory-dependency/bcb/com/example/example-project-bcb/${project.version}</outputDirectory>
<includes>
<include>com.example:example-project-bcb:jar:${project.version}</include>
</includes>
<useTransitiveDependencies>false</useTransitiveDependencies>
<useStrictFiltering>true</useStrictFiltering>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
</assembly>
note

Mind the ${project.version} variable used in the package descriptor. The project version is defined during the project initiation stage and stored in the root pom.xml. Though it can be changed—generally incremented—at any time, it is not recommended to manually change this version in pom.xml. Instead, use the ODF 2 versioning plugin: it automates versioning of all artifacts for your project, so it's safe to execute 2+ versions of the same AI Agent simultaneously in a single Control Tower.

In the case of the Simple Archetype, the packaged BCB JAR file is dynamically copied into the Bundle zip file. Thus, you can't find the compiled module JAR file within the src folder. During the Bundle generation, the JAR is copied there dynamically and available from the resulting zip artifact. The file also appears in the auto-created target folder.

The src folder contains all static resources that you can manually place and check in to version control at any time before a build. If you add a Business Process package or a custom Manual Task to a Bundle for deployment to Control Tower, put the resources into proper folders within src.

For example, if you need to create Data Stores, put CSV files into [UC_CODE]-package/src/main/resources/datastore. You can do the same can with rules, required files, templates for Manual Tasks, Operations, or AI Agent templates. Inside the business-process folder, put the zip packages of the Business Process downloaded manually from Control Tower.

Compile and build project

To clean previously compiled files, re-compile all modules, run tests, build the latest Bundle, and install all JARs into your machine's local Maven repository using the following command:

mvn clean install

Sometimes, you can get an error, but Maven lacks trace information in the console. Build in the debug mode:

mvn clean install -X

In some cases, when you build locally and want to save time by skipping tests, use this command:

mvn clean install -DskipTests
caution

It is strongly recommended to run tests as frequently as possible, even on your local machine.