OpenL Tablets — OpenL Maven Plugin (openl-maven-plugin)
OpenL Tablets — OpenL Maven Plugin (openl-maven-plugin)
Integrates OpenL rules compilation into the Maven lifecycle. Runs on Java 21 and Maven 3.8.8 or later.
<!-- inside the project's pom.xml -->
<!-- `openl` packaging is a zip file. -->
<packaging>openl</packaging>
<build>
<plugins>
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<extensions>true</extensions> <!-- activates openl packaging + lifecycle bindings -->
</plugin>
</plugins>
</build>
<!-- All runtime scoped dependencies will be added in lib/*.jar folder on the package phase. -->
<!-- optional, provided and test scoped dependencies are not included in the final package. -->
<dependencies>
<dependency> <!-- OpenL project: zip with rules.xml -->
<groupId>com.example</groupId>
<artifactId>shared-data-project</artifactId>
<version>1.0.0</version>
<optional>true</optional>
<type>zip</type>
</dependency>
<dependency> <!-- Java library which will be added in the final OpenL packaged project. -->
<groupId>com.example</groupId>
<artifactId>common-library</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
| Goal | Default Phase | Purpose |
|---|---|---|
sync-versions |
validate |
Actualize dependency versions in rules.xml |
compile |
compile |
Compile OpenL rules; validate syntax and types |
test |
test |
Execute Test tables; generate JUnit XML + XLSX reports |
verify |
verify |
Run all validations including OpenAPI reconciliation |
generate |
generate-sources |
Generate Java interfaces and datatype classes from rules |
package |
package |
Package rules as a ZIP artifact for deployment |
deploy |
deploy |
Deploy the packaged artifact to an OpenL Tablets repository |
migrate |
Migrates or modernizes OpenL Project and Maven modules [3] | |
prepare-bom |
package |
Generates BOM with all OpenL projects [1] |
prepare-pom |
validate |
Writes openl-pom.xml for install/deploy [1] |
pomless |
Converts classic pom-ful OpenL projects to pom-less [2] |
Notes:
- [1] — Applicable to pom-less projects only.
- [2] — Aggregator goal, dry-run by default. On apply (
-Dopenl.pomless.dryRun=false) it deletes cleanly-convertible projects’pom.xmland edits each project’s anchor — the nearest non-OpenL aggregator pom that contains it, never a higher parent — to declare the plugin (<extensions>true</>+ version), set the max<dependenciesThreshold>, and hoist non-OpenL deps, then prunes the converted modules from<modules>. Blocked projects (per-project config other thandependenciesThreshold,deploymentPackageanddeploymentName, executions, profiles, …) are left untouched and reported. Pom edits re-serialise the model — review the diff. - [3] — Rewrites
rules.xml,rules-deploy.xml, Groovy and removed-function calls, drops no-effect plugin params inpom.xml; a commit per step.openl:help -Dgoal=migrate -Ddetaillists steps,-Dopenl.migrate.migratorspicks.
Every goal except deploy is thread-safe, so a parallel build (mvn -T 1C verify) runs the goals of independent
modules at the same time without the Maven warning about plugins not marked as thread-safe. verify starts one OpenL
Rule Services application per module, so the heap of the build grows with the number of threads.
deploy is not marked as thread-safe, and a parallel build that runs it prints that warning: two modules that deploy
the same deployment name at the same time can both be stored, where a sequential build skips the second one.
[!Note]
generatecreates a Java interface from the project’s<exposed-methods>filter, for type-safe rule invocation.
Test reports
The test goal writes one report of each format in reportsFormat (junit4, xlsx) for every Test table, into
target/openl-test-reports, named TEST-OpenL.<module>.<test>. A Test table with a name of its own is reported
under that name. A Test table without one, such as Test SayHello, is reported under the name of the table it tests
followed by Test: SayHelloTest, then SayHelloTest-2 and so on when the module has several. Any table whose name
a table of the same module reported before it already took gets such a number, even a table named by its author:
a Test table named SayHelloTest next to Test SayHello can be reported as SayHelloTest-2.
Skipping tests
A build with -DskipTests or -Dmaven.test.skip=true neither validates nor runs the tests of the project:
compileleaves the modules of thetests/folder out of compilation and logs how many it left out. The other modules compile as usual, and an error in them still fails the build.testruns no Test tables, andverifystarts no OpenL Rule Services.packagestill attaches thetestsartifact.generateand the Markdown copy ofopenl.markdownstill read the whole project,tests/included.- Without these flags, an error in a
tests/workbook fails the build. - A rules module must not use a datatype or a module of
tests/: such a build cannot find it, as OpenL Rule Services cannot in the main artifact.
Supplementary artifacts
openl:package attaches supplementary artifacts next to the main archive:
| Classifier | When attached |
|---|---|
classes |
target/classes is not empty — built as <finalName>-classes.jar |
tests |
The OpenL source folder contains tests/** |
deployment |
Depends on other OpenL projects and rules-deploy.xml publishers not empty |
- The main archive holds no file of
tests/, and itsrules.xmlnames no file or folder there. A path pattern such astests/*.xlsxstays, as it finds no file. - A project whose modules all lie in
tests/gets the patterntests/**instead, not the default modules. - The
classesjar is also embedded into the zip archive aslib/<finalName>.jar(runtime classpath); depend on it with<classifier>classes</classifier>. - Not built when a main jar artifact already exists or for
openl-jarpackaging (classes go to the jar root). - The
deploymentarchive is<finalName>-deployment.zip, named<finalName>in itsdeployment.yaml;openl:deployuploads it instead of the main archive. The deprecateddeploymentNamehas no effect and logs a warning.
Pom-less OpenL projects
Anchor pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>rules-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
It discovers every rules.xml folder under its basedir as a <packaging>openl</packaging> module.
Each OpenL folder holds only rules.xml + the standard layout (project-structure.md).
mvn install from the anchor synthesises a model per project and installs the .zip + pom.
- Multiple anchors allowed (top-level + submodule, or a submodule alone).
- Anchor packaging: any except
openl/openl-jar(those are OpenL projects themselves, not rescanned).
Coordinates derive from the folder path under the anchor:
artifactId— folder namegroupId— anchor<groupId>+ dotted intermediate pathversion— inherited from the anchor
Example: anchor com.example + pricing/auto/rules.xml → com.example.pricing:auto:<anchor-version>.
Inheritance from the anchor
Synthesised with the anchor as <parent>; inherits via Maven:
<build><plugins>— anchor plugins (e.g. source generators ongenerate-sources) fire on every pom-less project;<inherited>false</inherited>opts one out.<build><pluginManagement>— config defaults for plugins the project declares (i.e.openl-maven-plugin).<properties>,<dependencyManagement>,<distributionManagement>,<repositories>— visible during the build.
flatten-maven-plugin is auto-skipped on pom-less projects: they expose rules.xml, not a pom, so it can’t build
their model — openl:prepare-pom produces the flattened install/deploy pom instead. The skip switch (flatten.skip)
exists only since 1.6.0, so an older inherited version is bumped to it for the in-memory build.
Installed pom strips <parent> and <build> → flat artefact pom, no anchor lineage.
OpenL Studio reads a pom-less project the same way: with the anchor as its parent, the anchor’s dependency management
setting the <mavenArtifact> versions (see rules.xml).
Cross-project dependencies
A rules.xml <dependency> becomes a Maven dependency:
- Explicit —
<mavenArtifact>g:a[:type[:classifier]]:v</mavenArtifact>(Aether order: version last; default typezip);jar-type entries get<optional>true</optional>(self-contained inlib/, not inherited downstream). - By name —
<name>only; resolved against reactor sibling OpenL projects, emitted with<type>zip</type>.
<mavenArtifact> wins when both present. A <dependency> without <name> is a library, not an OpenL project: the
loader leaves it to the classpath, which gets it from lib/ of the packaged archive, and OpenL Studio downloads it
from its Maven repository (see rules.xml).
A <mavenArtifact> resolving to a reactor OpenL artefact (pom-less under any anchor, or a classic openl module) takes
the reactor version, whatever the coordinate declares. Precedence: anchor <dependencyManagement> > reactor-sibling
version > literal <mavenArtifact> version. Management is the opt-out — pin a sibling to a published version on
purpose.
openl:sync-versions (bound to validate) rewrites each <mavenArtifact> version in rules.xml in place to that resolved
value — managed coordinates and reactor siblings alike, same precedence.
Discovery rules
- Folders with a real
pom.xmlare NOT discovered — classic projects untouched. target/and hidden dirs skipped.- Scanner stops at the first
rules.xml— nested OpenL projects need a separate anchor. - Folder names must match
[A-Za-z0-9._-]+; invalid paths fail the build.
Generated artifacts
The synthesised pom stays in memory; the project root is never written. openl:prepare-pom (validate phase) writes a
flat target/openl-pom.xml for install/deploy. The .zip lands in the same target/, installed with the derived GAV.
Deployment BOM
openl:prepare-bom (auto-bound, package phase) attaches a BOM to the anchor — classifier deployment-bom, type
pom, same GA — listing every OpenL project under the anchor (pom-less + classic openl modules):
<dependencyManagement>— each project’s main entry, plus a<classifier>deployment</classifier>entry for each that ships a*-deployment.zip(has an OpenL dep AND non-empty<publishers>). All versions managed; opt in explicitly.<dependencies>— deployable projects only (non-empty<publishers/>): deployment-classifier entry for OpenL-dep projects, main entry for leaves. Empty-publisher projects are omitted here but stay in<dependencyManagement>.
Consumer — canonical BOM (scope=import, then list deps without versions):
<dependency>
<groupId>com.example</groupId>
<artifactId>rules-parent</artifactId>
<version>1.0.0</version>
<classifier>deployment-bom</classifier>
<type>pom</type>
<scope>import</scope>
</dependency>
One-shot bundle (one dep pulls every OpenL artefact transitively): same block, drop <scope>import</scope>.