Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6371

Use ServiceLoader mechanism in JDK9 in maven plugins

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.5.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      It'd be nice to be able to use the ServiceLoader mechanism in maven plugins when using JDK9:

       

      
      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();
          }
      }
      

       

      Work around is to use a different classloader.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jpoth John Poth
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: