apache / apache/maven-dependency-plugin

[MDEP-846] Source-only dependencies are not detected

Open
#1,352 2 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

**[Richard Eckart de Castilho](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rec)** opened **[MDEP-846](https://issues.apache.org/jira/browse/MDEP-846?redirect=false)** and commented

If a class in the `src/main/java` part module A has a source-only dependency on a class in module B, the dependency dependency of A to B is not detected. This can lead to build failures if any class in the `src/main/test` part of module A also has dependencies on module B as the analyzer claims that the dependency of module B should be moved to the `test` scope. Doing so - however - then breaks the build.

One such source-only dependency would be the import of a compile-time constant (e.g. static final String = "XXX") from a class in module B. Such constants are inlined into the class file produced for the class of module A. Thus, the compile-time dependency on module B cannot be determined by inspecting the class file using ASM.

---

**Issue Links:**
- [MSHARED-1211](https://issues.apache.org/jira/browse/MSHARED-1211) Source-only dependencies are not detected
(_**"duplicates"**_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the multi-module case described: a class in src/main/java imports a compile-time constant from module B, while a test in src/main/test also depends on B. Compare the analyzer's dependency result with the expected A-to-B compile dependency; done means the source-only dependency is retained and the test dependency is not incorrectly recommended for test scope.

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
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.