microsoft / vscode-maven

VSCode extension "Maven for Java"
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven
Other
182 stars 88 forks source link

improve way of fetching available plugin goals #895

Closed Eskibear closed 1 year ago

Eskibear commented 1 year ago

current impl

Run mvn help:describe and parse output for available goals. It's slow because we need to launch a JVM and download its deps if necessary.

alternative

Read mojos directly from .jar file, it's located in META-INF/maven/plugin.xml. And we can download the single plugin.jar if missing, instead of downloading all its deps.

plugin.xml

<plugin>
  <name>Spring JavaFormat Maven Plugin</name>
  <description>Spring JavaFormat</description>
  <groupId>io.spring.javaformat</groupId>
  <artifactId>spring-javaformat-maven-plugin</artifactId>
  <version>0.0.31</version>
  <goalPrefix>spring-javaformat</goalPrefix>  //<------GOAL_PREFIX
  <isolatedRealm>false</isolatedRealm>
  <inheritedByDefault>true</inheritedByDefault>
  <mojos>
    <mojo>
      <goal>apply</goal> //<------GOAL
      <description>Applies source formatting to the codebase.</description>
      <requiresDirectInvocation>false</requiresDirectInvocation>