Skip to content

Artifact defined in a BOM project results in entry without version which is inherited from a parent #12660

Closed

Description

@khmarbaise

Affected version

4.0.0-rc-6

Bug description

Affected version

Maven 4.0.0-rc6

Bug description

This is a followup scenario related to issue

The same reproducer Git Repo: https://github.com/khmarbaise/maven-bug-4.0.0-rc6-bom

The root pom of the project defines some parts in dependency management like this:

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

The bom-project which is of type packaging bom contains the following:

  <dependencyManagement>
    <dependencies>
      <dependency>
          <groupId>com.soebes.examples.maven4</groupId>
          <artifactId>mod-1</artifactId>
      </dependency>
      <dependency>
          <groupId>com.soebes.examples.maven4</groupId>
          <artifactId>mod-2</artifactId>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

What I expected to have is that the resulting BOM file contains only resolved versions for the given modules plus the entry for junit-jupiter-api like this:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.soebes.examples.maven4</groupId>
  <artifactId>bom</artifactId>
  <version>3.0.6</version>
  <packaging>pom</packaging>
  <name>Maven 4 :: BOM :: MOD BOM</name>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.soebes.examples.maven4</groupId>
        <artifactId>mod-1</artifactId>
        <version>3.0.6</version>
      </dependency>
      <dependency>
        <groupId>com.soebes.examples.maven4</groupId>
        <artifactId>mod-2</artifactId>
        <version>3.0.6</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>6.1.1</version>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

but what I get is:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.soebes.examples.maven4</groupId>
  <artifactId>bom</artifactId>
  <version>3.0.6</version>
  <packaging>pom</packaging>
  <name>Maven 4 :: BOM :: MOD BOM</name>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.soebes.examples.maven4</groupId>
        <artifactId>mod-1</artifactId>
        <version>3.0.6</version>
      </dependency>
      <dependency>
        <groupId>com.soebes.examples.maven4</groupId>
        <artifactId>mod-2</artifactId>
        <version>3.0.6</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

The first two entries are the defined modules within the multi-project build which are fine, but the entry without the version is wrong:

      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <scope>provided</scope>
      </dependency>

Activity

  1. added
    bug
    on Aug 2, 2026
  2. changed the title [-]BOM resolution for artifact from a BOM inherited from parent[/-] [+]Artifact defined in a BOM project results in entry without version which is inherited from a parent[/+] on Aug 2, 2026
  3. added this to the 4.0.0-rc-7 milestone on Aug 23, 2026
  4. added 4 commits that reference this issue on Aug 30, 2026
    1ae7581
    848b288
    9277f7d
    cc32930
  5. added a commit that references this issue on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmvn4

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions