apache / apache/maven-surefire

[SUREFIRE-1476] useSystemClassLoader=false doesn't work as expected after 2.8.1

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

**[Ivan Kelly](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ikelly)** opened **[SUREFIRE-1476](https://issues.apache.org/jira/browse/SUREFIRE-1476?redirect=false)** and commented

I have a test case where I want to load a bunch of jars in a custom classloader, and check that they are isolated from the classes in the classloader within which the test is running. This is for BC testing elsewhere in my code.

 

See

https://github.com/ivankelly/bookkeeper/blob/faa9f6db6f6861b9579be441227621bb06f0fac8/tests/integration-tests-utils/pom.xml

 

Run test in that module to see it work correctly. Change the surefire plugin to a newer version to see it fail. The problem seems to be that all dependencies are being added to the classpath of the forked processes, so no matter what happens, they are in the system class loader.

---

0 votes, 5 watchers

Contributor guide

Open the contributing guide

Research direction

Start with the linked BookKeeper integration-tests-utils/pom.xml and run that module's test with the older and newer Surefire versions to reproduce the class-loader difference. Then trace how the forked process classpath is assembled when useSystemClassLoader=false; done means dependencies are no longer visible through the system class loader and the isolation test passes.

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.