requireSameVersions drops members from its message when sources share a version

Closed Beginner friendly
#1,074 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #1075 by @arturobernalg — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Read RequireSameVersions.java:74-93 and trace how execute combines dependencies, build plugins, and report plugins by version. Reproduce the example with two artifacts at version 1.0 and another at 2.0, then check the relevant rule tests for the failure message. Done means the 1.0 message includes members from both sources while version detection still works.

Written by the indexing model from the issue text.

Description

bug

RequireSameVersions.execute builds one Map<String, List<String>> keyed by version and fills it with three putAll calls, for dependencies, build plugins and report plugins (RequireSameVersions.java:74-93). When two of those sources have an artifact at the same version, the later putAll replaces the earlier list for that version, so the failure message no longer lists the earlier members. Detection is unaffected (versionMembers.size() > 1 counts the same keys), only the message is incomplete.

Example: a dependency foo:a:1.0 and a build plugin foo:b:1.0 matching the same pattern, plus a dependency at 2.0: the 1.0 line names only the plugin.

Dominant language
Java
Stars
162
Forks
190
Avg merge
1d 17h
Merged PRs (30d)
20

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/maven-enforcer

All issues in apache/maven-enforcer

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.