Fluent Commerce Logo
Docs

Existing Source Code Module Conversion

Use CaseExamples that showcase what's possible with the platform. These use cases focus on feature and capability discovery and may not include implementation details.

Author:

Fluent Commerce

Changed on:

6 Apr 2026

Problem

Inheriting Java rule classes from another team, a previous agency, or a decompiled JAR is a common reality in long-running Fluent Commerce implementations, yet the path from raw source to a properly structured, buildable, and deployable module is rarely straightforward. Code received in this way frequently lacks a build system, uses inconsistent package naming, and is missing the annotations and module metadata that Fluent Commerce requires to register and execute rules correctly. Decompiling a JAR produces Java files, not a working module, and the gap between those two things demands a level of platform-specific knowledge that most developers encountering the problem for the first time do not yet have. Restructuring the source manually introduces compounding risk: renaming packages, correcting base class references, and reorganising files across a large codebase creates ample opportunity for import errors and compilation failures that are difficult to trace when they occur across many interdependent files simultaneously. Even when the structural work is completed, recreating rule registrations, build scripts, and module configuration from scratch requires precise knowledge of the Fluent module format, and code brought in from external sources almost never includes tests, leaving the team with no way to validate rule behaviour before deployment. Without cross-referencing the restructured source against what is actually deployed in the environment, there is no reliable way to confirm that the local code and the live rules represent the same implementation.

A development team takes over a Fluent Commerce implementation from an outgoing agency. The handover package includes a single JAR file, a folder of loose Java rule classes with no build configuration, and a spreadsheet listing rule names without descriptions. The new team decompiles the JAR and discovers forty-one rule classes spread across inconsistent package structures, several of which extend a base class that has been renamed in the current SDK version. Two weeks are spent manually restructuring the source into a Maven project, during which three rules develop compilation errors caused by package rename conflicts that are difficult to isolate. The module configuration file is written from scratch based on documentation, but two rule registrations are missed, meaning those rules are absent from the deployed module without any error message to indicate the omission. No tests exist for any of the rules, and when one behaves incorrectly in the test environment, the team has no baseline to debug against.

Solution Overview

Onboarding existing source code into a proper Fluent module begins with pointing the tool at the code that needs to be restructured, whether that is a decompiled JAR directory, a folder of loose Java files, or a project using a non-standard build system. The tool analyses what it finds, identifies all the rule classes present by looking for the patterns that define them, and assesses what kind of restructuring will be needed.Before making any changes, the tool produces a detailed plan showing exactly what it intends to do. This includes which files will move and where, what code changes are required such as package renames, base class corrections, or missing annotations, and a risk assessment highlighting anything that could cause problems. Nothing is changed until this plan has been reviewed and approved, giving the team full visibility and control before any restructuring begins.Once approved, the tool carries out the restructuring in full. It creates the correct Maven multi-module directory layout, moves and repackages the Java files, fixes any structural issues it identified, and generates all the supporting files needed for a complete module, including the rule registration configuration, build scripts, and project metadata. Test skeletons are also generated for any rules that currently have no test coverage.With the structure in place, the module is validated and a build is attempted to confirm everything compiles correctly. The tool also cross-references the restructured rules against what is currently deployed, so the team has a clear picture of how the local source aligns with the live environment.The result is a clean, buildable, deployable module produced from whatever form the original source arrived in, with a transparent and reviewable process at every step.

Solution