Skip to content

[DBCP-589] Add commons-dbcp2-jakarta module (managed package on jakarta.transaction) - #544

Open
czpilar wants to merge 2 commits into
apache:masterfrom
czpilar:jakarta-multimodule
Open

czpilar wants to merge 2 commits into
apache:masterfrom
czpilar:jakarta-multimodule

Conversation

@czpilar

@czpilar czpilar commented Sep 25, 2026

Copy link
Copy Markdown

This PR implements DBCP-589 along the direction discussed in #492: a multi-module 2.x build with a new commons-dbcp2-jakarta artifact, while commons-dbcp2 stays binary compatible.

It supersedes #492, which migrated the existing managed package from javax.transaction to jakarta.transaction in place and therefore broke binary compatibility (japicmp). Here the javax flavour stays as it is and the jakarta flavour is generated from it at build time.

Layout

commons-dbcp2-parent        parent and aggregator (pom)
commons-dbcp2               unchanged artifact: core + javax.transaction based managed package
commons-dbcp2-jakarta       org.apache.commons.dbcp2.managed.jakarta on jakarta.transaction-api 2.0.1
commons-dbcp2-distribution  bin and src archives, as in commons-vfs

No duplicated sources

commons-dbcp2-jakarta has no Java sources in git. In generate-sources / generate-test-sources an antrun step copies org.apache.commons.dbcp2.managed (and the managed / transaction tests) from commons-dbcp2 and rewrites them:

  • javax.transaction.* becomes jakarta.transaction.*, except javax.transaction.xa, which is part of the JDK.
  • org.apache.commons.dbcp2.managed becomes org.apache.commons.dbcp2.managed.jakarta, and the test helper package org.apache.commons.dbcp2.transaction becomes org.apache.commons.dbcp2.transaction.jakarta.
  • @since values older than 2.15.0 become 2.15.0. Newer values are kept, so later additions to managed get the right version in both flavours.

The generated sources go through the normal compile, test, javadoc, sources-jar, SpotBugs, PMD, moditect and OSGi steps. Checkstyle is skipped in that module because the originals are already checked in commons-dbcp2. A fix in managed applies to both flavours automatically.

Details

  • Moved sources: src/main, src/test and src/conf are in commons-dbcp2/ via pure renames in a separate commit, so git log --follow and blame keep working. src/site, src/changes and src/media stay at the root.
  • JPMS: the commons-dbcp2 module descriptor now has requires static java.transaction. The JTA API is only needed by the managed package, and commons-dbcp2-jakarta users on the module path don't need the javax API.
  • Dependencies: commons-dbcp2-jakarta excludes jakarta.transaction-api 1.3.3 (the javax packages) from commons-dbcp2 and depends on jakarta.transaction-api 2.0.1. Runtime dependencies are commons-dbcp2, commons-pool2, commons-logging and jakarta.transaction-api 2.0.1. cdi-api and interceptor-api are provided, only for jdeps. Test dependencies use the jakarta flavours of Narayana and Geronimo, with the versions kept Java 8 compatible.
  • Distribution: commons-dbcp2-distribution builds the bin archive (both jars plus javadoc) and the src archive (the whole multi-module tree) in the release profile. The root and the code modules skip the assembly.
  • Site: each module has its own Javadoc (/commons-dbcp2/apidocs/, /commons-dbcp2-jakarta/apidocs/). The menu, index and building pages are updated, and the index documents the new Maven coordinates. The old /apidocs/ URL could be kept when publishing via ignorePathsToDelete if you prefer.
  • Version: bumped to 2.15.0-SNAPSHOT, since a new artifact is a new feature. commons.bc.version stays 2.14.0.
  • Other: changes.xml has an entry for DBCP-589, and .gitignore now ignores the Narayana ObjectStore/ directories in the modules too.

Verification

  • The default goal (mvn) passes on Java 8, 11, 17, 21 and 25: 1605 tests in commons-dbcp2, 275 generated tests in commons-dbcp2-jakarta. japicmp against 2.14.0 is green.
  • mvn -Prelease -Dgpg.skip -Dcommons.release.isDistModule=false verify builds the bin and src archives.
  • mvn package site site:stage generates the site.
  • Tested downstream in an application running Narayana JTA with commons-dbcp2-jakarta on jakarta.transaction 2.0.1.

AI disclosure: Claude Code (Anthropic) was used to restructure the build, write the POM and assembly changes, and run the verification builds. I reviewed all changes.

Prepares a multi-module build for DBCP-589. Renames only, no content
changes, so that history and blame follow the moved files.
- Turn the root into the commons-dbcp2-parent aggregator; commons-dbcp2
  keeps its coordinates and binary compatibility
- Add commons-dbcp2-jakarta, generated at build time from
  org.apache.commons.dbcp2.managed into
  org.apache.commons.dbcp2.managed.jakarta on jakarta.transaction-api 2.0.1
- Add commons-dbcp2-distribution for the bin and src archives
- Make java.transaction a static requirement of the commons-dbcp2 module
- Update the site and changes.xml, bump the version to 2.15.0-SNAPSHOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant