apache / apache/maven-surefire

[SUREFIRE-1902] Non-modules are put on the module path when test sources contain a module-info file

Open
#2,955 0 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Stefan Oehme](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=oehme)** opened **[SUREFIRE-1902](https://issues.apache.org/jira/browse/SUREFIRE-1902?redirect=false)** and commented

When the test sources contain a module-info file, Surefire currently [puts everything on the module path](https://github.com/apache/maven-surefire/blob/b9b2381a3dba6574bb69bd91d45fe0edea29c779/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L2057), even dependencies that are not modules.
When the main sources contain a module-info file, it [uses Plexus-Java](https://github.com/apache/maven-surefire/blob/b9b2381a3dba6574bb69bd91d45fe0edea29c779/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L2034) to determine what to put on the module path and what to put on the classpath.

I'm not sure what kind of use cases this will break, but it seems inconsistent to me. Shouldn't Plexus-Java be used in both cases? Marking as a minor issue since I'm not blocked by this, I was just curious why this was done differently.

---

**Affects:** 3.0.0-M5

Contributor guide

Open the contributing guide

Research direction

Start in maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java at the linked lines around 2034 and 2057. Compare how Plexus-Java determines the module path for main sources with the test-source path handling, then identify the expected treatment of non-modular dependencies and verify the behavior with the relevant Surefire tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.