Skip to content

GH-4107: jena-bom altered to include jena artifacts using flatten-maven-plugin - #4114

Open
Aklakan wants to merge 1 commit into
apache:mainfrom
Aklakan:20260801_flat-bom
Open

GH-4107: jena-bom altered to include jena artifacts using flatten-maven-plugin#4114
Aklakan wants to merge 1 commit into
apache:mainfrom
Aklakan:20260801_flat-bom

Conversation

@Aklakan

@Aklakan Aklakan commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

GitHub issue resolved #4107

Pull request Description: This proposal adds flatten-maven-plugin to jena-bom in order to produce a parent-free "jena-only" pom.

I think this should solve the reported issue that jena-bom overrides versions from a parent pom.

Minimal downstream project pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

    <groupId>org.example.jena</groupId>
    <artifactId>jena-bom-test</artifactId>
    <packaging>jar</packaging>

    <properties>
      <jena.version>6.3.0-SNAPSHOT</jena.version>
    </properties>

    <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>4.1.0</version>
    </parent>

    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.apache.jena</groupId>
          <artifactId>jena-bom</artifactId>
          <version>${jena.version}</version>
          <type>pom</type>
          <scope>import</scope>
        </dependency>
     </dependencies>
  </dependencyManagement>

</project>

Creating the effective pom with and without the jena dependency commented out, and then creating a diff shows that the only difference is the jena deps. This means that all non-jena dependency versions are taken from spring-boot-starter-parent, and adding jena-bom does not alter any versions.

mvn help:effective-pom > without-jena.txt # jena dep commented out
mvn help:effective-pom > with-jena.txt
diff without-jena.txt with-jena.txt
+       <groupId>org.apache.jena</groupId>
+         <artifactId>apache-jena-libs</artifactId>
+         <version>6.3.0-SNAPSHOT</version>
+         <type>pom</type>
+       </dependency>
+       <dependency>
+         <groupId>org.apache.jena</groupId>
+         <artifactId>jena-base</artifactId>
+         <version>6.3.0-SNAPSHOT</version>
+       </dependency>
+       <dependency>
+         <groupId>org.apache.jena</groupId>
+         <artifactId>jena-core</artifactId>
+         <version>6.3.0-SNAPSHOT</version>
+       </dependency>

  • [ ] Tests are included.
  • [ ] Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

@afs

afs commented Aug 1, 2026

Copy link
Copy Markdown
Member

My understand is that the issue is BOM-related.

apache-jena-libs isn't a BOM - it does not have a <dependencyManagement> section.

It's also been around a very long time!

@Aklakan
Aklakan force-pushed the 20260801_flat-bom branch from 7ff48da to baa4363 Compare August 1, 2026 22:43
@Aklakan

Aklakan commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Right, I removed the flatten plugin from apache-jena-libs.

@afs

afs commented Aug 2, 2026

Copy link
Copy Markdown
Member

Thanks.

As I understand it, a regular <dependence> on an artifact does not pull in the artifacts parent dependency management, only the recursive dependency tree.

Eclipse Jetty uses flatten-maven-plugin. Some other projects I looked at do not take any special actions for BOMs.

@Aklakan

Aklakan commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

According to the spring-boot-starter-parent documentation this is a legit way to kick start a spring boot project. I wasn't aware of this approach of using their parent pom (and the doc also mentions that there may be reasons to avoid it) - but getting all the versions of a spring/spring-boot based app right is frequently a pain - and if this flattened pom helps with it, then all the better.

@afs

afs commented Aug 2, 2026

Copy link
Copy Markdown
Member

Let's put this into the codebase.

I can't recreate a problem using apache-jena-libs on its own, either as a direct <dependency> or in <dependencyMangement>. Only if jena-bom is present.

@afs

afs commented Aug 2, 2026

Copy link
Copy Markdown
Member

I've removed the "GitHub issue resolved" - that's pending clarification of the use of apache-jena-libs on it's own.

@afs

afs commented Aug 2, 2026

Copy link
Copy Markdown
Member

The .flattened-pom.xml is not great. It includes the parent <properties>.

The best I have come up with so far is remove some POM elements (by looking at the source code for flatten-maven-plugin). For example, this is a quite heavy trimming:

        <configuration>
          <flattenMode>bom</flattenMode>
          <pomElements>
            <properties>remove</properties>
            <distributionManagement>remove</distributionManagement>
            <mailingLists>remove</mailingLists>
            <scm>remove</scm>
            <issueManagement>remove</issueManagement>
          </pomElements>
        </configuration>

(We should separately tidy up the top Jena POM.)

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.

BOM is not usable with spring-boot-starter-parent

2 participants