A common requirement from development team is to be able to define reusable business logic that can be developed once and shared across multiple projects. In BAMOE 9.3.1 we are introducing a new build-time model discovery paradigm that enables selected subprocess models to be maintained separately and shared across projects. Instead of generating code inside dependent modules, all code generation now happens during the build of the Quarkus/Spring-boot base business application.What really makes this model work is a single, crucial condition: every BPMN file must be visible in the classpath when the application is being compiled.
When this condition is met, the code generator automatically discovers every model and generates executable code for all of them,regardless of the artifact in which they were originally defined.This makes subprocess reuse cleaner, more modular, and fully aligned with standard Maven dependency management.
In BAMOE 9:
- Subprocess projects provide only BPMN definitions
- Subprocess project do not perform code generation
- The Business Application:
- Imports those models at build time
- Generates code for both local and external processes together
- Executes everything seamlessly at runtime
Step 1: Create the Subprocess Module
Create a standalone Maven module that contains only the subprocess definitions.
Step 2: Register target/generated-resources as a Resource Folder
This folder will receive the extracted BPMN files and must be scanned during build.
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
3. Extract BPMN Models During the generate-resources Phase
Use the maven-dependency-plugin to unpack BPMN files from the subprocess artifact:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${dependency-plugin.version}</version>
<executions>
<execution>
<id>unpack-subprocess-models</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.ibm.bamoe</groupId>
<artifactId>reusable-subprocess-project</artifactId>
<version>1.0.0</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/generated-resources
</outputDirectory>
<includes>**/*.bpmn</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Step 4: Build the Business Application
Build and run the Quarkus or Spring Boot Business Application using standard commands. The generated code from both projects is compiled together and executed as a single, unified workflow application.
For Quarkus application
# Build the application
mvn clean package
# Run in development mode
mvn quarkus:dev
# Run the packaged application
java -jar target/quarkus-app/quarkus-run.jar
For SpringBoot application:
# Build the application
mvn clean package
# Run using Maven
mvn spring-boot:run
# Run the packaged JAR
java -jar target/applicationName.jar
Conclusion
BAMOE 9 adopts a build-time subprocess discovery model that replaces earlier KJAR-based integration patterns. By treating subprocess BPMN files as standard Maven resources and making them available during compilation, you can safely and efficiently reuse process logic across multiple Business Services.
This approach improves modularity, simplifies builds, and aligns workflow development with modern Java and cloud-native practices.
Acknowledgment: Special thanks to Gabriele Cardosi for proposing and shaping this approach for enabling reusable processes across projects.