[MENFORCER-432] requireUpperBoundDeps support for checking dependencyManagement
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Start with the requireUpperBoundDeps rule and inspect how maven-dependency-tree determines managed dependencies in DefaultDependencyCollectorBuilder and the older Maven31DependencyCollectorBuilder. Use the provided BOM example as a reproduction and verify that dependencyManagement conflicts are detected, with a way to enable or disable the check if that design is retained.
Written by the indexing model from the issue text.
Description
Marcono1234 opened MENFORCER-432 and commented
For projects which are either used as parent by other projects, or which are used as Bill of Materials (BOM) and which declare dependencies in the dependencyManagement it would be useful if requireUpperBoundDeps was able to check the dependencies in the dependencyManagement. This would allow verifying that the versions of these managed dependencies are correct and do not cause any issues for consuming projects.
Currently requireUpperBoundDeps seems to only check regular dependencies; this prevents it from being used directly on the parent / BOM project, but requires applying it on all consuming projects.
It would be quite useful to already detect conflicting dependency versions directly in the parent / BOM project.
Maybe a separate option for this (e.g. checkDependencyManagement) would be useful to allow enabling / disabling this check.
It appears maven-dependency-tree already determines those managed dependencies in DefaultDependencyCollectorBuilder respectively Maven31DependencyCollectorBuilder (in older versions), but does not expose this information.
Example
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-bom</artifactId>
<version>1</version>
<packaging>pom</packaging>
<dependencyManagement>
<!-- Example from https://maven.apache.org/enforcer/enforcer-rules/requireUpperBoundDeps.html -->
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.9</version>
<!-- Depends on org.slf4j:slf4j-api:1.5.0 -->
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<requireUpperBoundDeps>
</requireUpperBoundDeps>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Running mvn validate passes. Only when changing the dependencyManagement to regular dependencies Maven Enforcer detects the rule violation.
Affects: 3.1.0, 3.2.1
- Dominant language
- Java
- Stars
- 162
- Forks
- 188
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 17
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-enforcer
-
RequireUpperBoundDeps does not support includes with only groupIdPossibly taken @waterWang claimed this 98 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/maven-enforcer#998 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/maven-enforcer#1038 · 1 comment ·
Maintainers usually reply within 1 day
-
New rule: banSplitPackages — detect packages split across modules and artifactsMay be free again @ascheman claimed this 104 days ago, and no pull request is open. Openenhancement
apache/maven-enforcer#997 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
New rules: enforce Java Module System descriptor policyMay be free again @ascheman claimed this 109 days ago, and no pull request is open. Openenhancement
apache/maven-enforcer#995 · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 25/100
apache/maven-enforcer#950 ·
Maintainers usually reply within 1 day
All issues in apache/maven-enforcer
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
liberation-data/drivine4j#547 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
BindingServiceProperties.bindings regressed to a non-thread-safe TreeMap in GH-3158: concurrent first use of binding names corrupts itPossibly taken @AkashB23 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
spring-cloud/spring-cloud-stream#3321 ·
Maintainers usually reply within 1 day
-
[Bug] 资源包列表 与 模组/数据包/世界 列表排列顺序不一致Possibly taken @fishdry1000 claimed this 4 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
ai-driven-fuzzing bug claude Minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
linagora/twake-calendar-side-service#1333 ·
Maintainers usually reply within 1 day