[MNG-6371] Use ServiceLoader mechanism in JDK9 in maven plugins
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[John Poth](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jpoth)** opened **[MNG-6371](https://issues.apache.org/jira/browse/MNG-6371?redirect=false)** and commented
It'd be nice to be able to use the ServiceLoader mechanism in maven plugins when using JDK9:
```java
import org.apache.maven.plugin.AbstractMojo;
public class MyMojo extends AbstractMojo {
public void execute() throws MojoExecutionException {
// this is empty
Iterator iterator = ServiceLoader.load(javax.tools.Tool.class).iterator();
}
}
```
Work around is to use a different classloader.
---
**Affects:** 3.5.2
**Issue Links:**
- [MNG-6275](https://issues.apache.org/jira/browse/MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm
Contributor guide
Assessment
This issue has not been assessed yet.