Skip to content

Dependency Management in profiles is not injected when imported from BOM #320

Closed

Description

@Syquel

Description

In case a BOM is being imported, which contains a profile with a dependencyManagement section, this section is not being injected into the Maven build when flatten-maven-plugin is used and the plugin fails to create the effective POM model.

Example

The BOM org.infinispan:infinispan-bom:13.0.11.Final defines a subset of its dependency management in a separate profile, which is activated by default:

[...]
<profile>
	<id>community-release</id>
	<activation>
		<activeByDefault>true</activeByDefault>
	</activation>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.infinispan</groupId>
				<artifactId>infinispan-marshaller-kryo</artifactId>
				<version>${version.infinispan}</version>
			</dependency>
			<dependency>
				<groupId>org.infinispan</groupId>
				<artifactId>infinispan-marshaller-kryo-bundle</artifactId>
				<version>${version.infinispan}</version>
			</dependency>
			<dependency>
				<groupId>org.infinispan</groupId>
				<artifactId>infinispan-marshaller-protostuff</artifactId>
				<version>${version.infinispan}</version>
			</dependency>
			<dependency>
				<groupId>org.infinispan</groupId>
				<artifactId>infinispan-marshaller-protostuff-bundle</artifactId>
				<version>${version.infinispan}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>
</profile>
[...]

In case a Maven project imports this BOM and declares a dependency on one of these managed dependencies the flatten-maven-plugin fails to build the effective POM model.
Error message: [ERROR] 'dependencies.dependency.version' for org.infinispan:infinispan-marshaller-kryo:jar is missing.

Example project POM:

[...]
<dependencyManagement>
	<dependencies>
		<!-- This BOM contains a profile 'community-release' which is activated by default -->
		<!-- This profile provides dependency management for the artifact 'org.infinispan:infinispan-marshaller-kryo' -->
		<dependency>
			<groupId>org.infinispan</groupId>
			<artifactId>infinispan-bom</artifactId>
			<version>13.0.11.Final</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

<dependencies>
	<dependency>
		<groupId>org.infinispan</groupId>
		<artifactId>infinispan-marshaller-kryo</artifactId>
	</dependency>
</dependencies>
[...]

Activity

  1. added a commit that references this issue on Oct 12, 2022
  2. added a commit that references this issue on Oct 21, 2022
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions