apache / apache/maven-surefire

[SUREFIRE-1731] Unable to test Multi Release Jar with surefire or failsafe

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

Description

**[John Patrick](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nhoj.patrick)** opened **[SUREFIRE-1731](https://issues.apache.org/jira/browse/SUREFIRE-1731?redirect=false)** and commented

I'm creating a Multi Release jar, containing base Java 1.8 and Java 11 classes. But am not able to successful test the Java 11 part.

In the following repo, I've got 3 tests.
* 1 test needs to be executed using Java 1.8 that are under src/test/java.
* 2 tests need to be executed using Java 11 that are under src/test/java11.

If the src/test/java tests are executed using Java 11 I expect it to fail which is expected, because it would be picking up the classes under target/classes/META-INF/versions/11/ and not the Java 1.8 version under target/classes/. Because the tests have been written to prove the correct source file is used for execution so the Java 1.8 BaseClass returns a different string to the Java 11 BaseClass.

https://github.com/nhojpatrick/issue-maven-multi-release-jar-testing

 

---

**Affects:** 2.22.2, 3.0.0-M4

**Issue Links:**
- [SUREFIRE-1234](https://issues.apache.org/jira/browse/SUREFIRE-1234) Allow to configure JVM for tests by referencing a toolchain entry
(_**"is blocked by"**_)

3 votes, 6 watchers

Contributor guide

Open the contributing guide

Research direction

Start with the linked SUREFIRE-1234 issue about selecting test JVMs through toolchains, then inspect how Surefire or Failsafe handles the example repository's src/test/java and src/test/java11 tests. Reproduce the multi-release JAR case with the supplied repository; done means the Java 8 and Java 11 tests run with their intended classes.

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.