You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2018/03/06 17:29:00 UTC
[jira] [Commented] (MNG-6371) Use ServiceLoader mechanism in JDK9
in maven plugins
[ https://issues.apache.org/jira/browse/MNG-6371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388141#comment-16388141 ]
Robert Scholte commented on MNG-6371:
-------------------------------------
We've tried to solve MNG-6275 for Maven 3.5.2, but didn't succeed. With the way Maven works with ClassLoaders it is not that straight forward. Still looking for the right solution.
> Use ServiceLoader mechanism in JDK9 in maven plugins
> ----------------------------------------------------
>
> Key: MNG-6371
> URL: https://issues.apache.org/jira/browse/MNG-6371
> Project: Maven
> Issue Type: Improvement
> Components: Class Loading, Plugins and Lifecycle
> Affects Versions: 3.5.2
> Reporter: John Poth
> Priority: Major
>
> It'd be nice to be able to use the ServiceLoader mechanism in maven plugins when using JDK9:
>
> {code:java}
> import org.apache.maven.plugin.AbstractMojo;
> public class MyMojo extends AbstractMojo {
> public void execute() throws MojoExecutionException {
> // this is empty
> Iterator<Tool> iterator = ServiceLoader.load(javax.tools.Tool.class).iterator();
> }
> }
> {code}
>
> Work around is to use a different classloader.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)