apache / apache/maven-dependency-plugin

[MDEP-715] Hamcrest used and unused

Open
#1,216 4 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Elliotte Rusty Harold](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=elharo)** opened **[MDEP-715](https://issues.apache.org/jira/browse/MDEP-715?redirect=false)** and commented

This is something I've seen when analyzing several Maven plugins. For example, maven-shared-utils circa July 20, 2020:

 

[WARNING] Used undeclared dependencies found:
[WARNING] org.hamcrest:hamcrest:jar:2.2:test
[WARNING] org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:test
[WARNING] Unused declared dependencies found:
[WARNING] org.hamcrest:hamcrest-core:jar:2.2:test
[WARNING] org.apache.maven:maven-core:jar:3.1.0:test
[WARNING] org.codehaus.plexus:plexus-container-default:jar:2.1.0:provided

 

Easy fix, right? don't declare org.hamcrest:hamcrest-core:jar:2.2:test and instead declare org.hamcrest:hamcrest:jar:2.2:test

 

But when I do that:

 

[WARNING] Used undeclared dependencies found:
[WARNING] org.hamcrest:hamcrest-core:jar:1.3:test
[WARNING] org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:test
[WARNING] Unused declared dependencies found:
[WARNING] org.hamcrest:hamcrest:jar:2.2:test
[WARNING] org.apache.maven:maven-core:jar:3.1.0:test
[WARNING] org.codehaus.plexus:plexus-container-default:jar:2.1.0:provided

 

Figure out what's going on here and fix it. Is hamcrest-core needed and used or not? is hamcrest needed and used or not? Be consistent.

 

---
No further details from [MDEP-715](https://issues.apache.org/jira/browse/MDEP-715?redirect=false)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the dependency-analysis warnings using the maven-shared-utils example and compare the results when hamcrest-core versus hamcrest is declared. Trace how the analyzer identifies used and unused test dependencies, then verify that the selected Hamcrest dependency is reported consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.