Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Management of maven-plugin-annotations causes warnings with Maven 4.0.0-beta-3 #265

Closed
wilkinsona opened this issue Sep 2, 2024 · 2 comments · Fixed by #266
Closed

Management of maven-plugin-annotations causes warnings with Maven 4.0.0-beta-3 #265

wilkinsona opened this issue Sep 2, 2024 · 2 comments · Fixed by #266
Labels
breaking enhancement New feature or request
Milestone

Comments

@wilkinsona
Copy link

The management of maven-plugin-annotations, when inherited by the boms of other Apache projects, is causing a warning with Maven 4.0.0-beta-3. The warning can be reproduced with the following pom.xml:

<?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.example</groupId>
	<artifactId>example</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>example</name>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.apache.pulsar</groupId>
				<artifactId>pulsar-bom</artifactId>
				<version>3.3.1</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>
			<dependency>
				<groupId>org.apache.activemq</groupId>
				<artifactId>artemis-bom</artifactId>
				<version>2.36.0</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>
		</dependencies>
	</dependencyManagement>
</project>

The warning is as follows:

[WARNING] Some problems were encountered while building the effective model for 'com.example:example:jar:0.0.1-SNAPSHOT'
[WARNING] Ignored POM import for: org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.13.1@compile as already imported org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.7.0@compile.  Add a the conflicting managed dependency directly to the dependencyManagement section of the POM.
@cstamas
Copy link
Member

cstamas commented Sep 2, 2024

Just some context: BOM use in Maven wildly differs from "ordinary" dependencies and many times cause (unwanted) surprise to end users. Hence, Maven 4 is getting more strict about them, and warns in any "unexpected" situation happens while flattening them (as part of Project building). Problems usually occur when "uber BOMs" are used, with many hundreds or thousands of import, and even worse, with recursive "BOM imports BOM..." chains.

Hence, I'd argue, that given BOM sole purpose is to provide dependency management entries downstream, hence all it should contain is dependency management entries, that BOMs should not have even parents. As we can see from this issue, when BOM has parent, it effectively loses control over its main purpose of existence.

@gnodet
Copy link
Contributor

gnodet commented Sep 3, 2024

That managed dependency should go away. Especially with Maven 4 plugins for which that dependency should not be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
4 participants