Class MavenCling

java.lang.Object
org.apache.maven.cling.ClingSupport
org.apache.maven.cling.MavenCling

public class MavenCling extends ClingSupport
Maven CLI "new-gen".

This is the default entry point for Maven. When launched via ClassWorlds, it checks the maven.mainClass system property and delegates to the specified class if set. This allows external tools (Maven Wrapper, IDEs) to launch Maven without setting the main class property — MavenCling is used as the default.

  • Constructor Details

    • MavenCling

      public MavenCling()
    • MavenCling

      public MavenCling(org.codehaus.plexus.classworlds.ClassWorld classWorld)
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      "Normal" Java entry point. Note: Maven uses ClassWorld Launcher and this entry point is NOT used under normal circumstances.
      Throws:
      IOException
    • main

      public static int main(String[] args, org.codehaus.plexus.classworlds.ClassWorld world) throws IOException
      ClassWorld Launcher "enhanced" entry point: returning exitCode and accepts Class World.

      When the maven.mainClass system property is set to a class other than MavenCling, this method delegates to that class's main(String[], ClassWorld) method via reflection. This makes MavenCling the default entry point that external tools (such as the Maven Wrapper or IDEs) can rely on without needing to set the maven.mainClass property.

      Throws:
      IOException
    • main

      public static int main(String[] args, org.codehaus.plexus.classworlds.ClassWorld world, @Nullable InputStream stdIn, @Nullable OutputStream stdOut, @Nullable OutputStream stdErr) throws IOException
      ClassWorld Launcher "embedded" entry point: returning exitCode and accepts Class World and streams.
      Throws:
      IOException
    • createInvoker

      protected Invoker createInvoker()
      Specified by:
      createInvoker in class ClingSupport
    • createParser

      protected Parser createParser()
      Specified by:
      createParser in class ClingSupport
    • createParserRequestBuilder

      protected ParserRequest.Builder createParserRequestBuilder(String[] args)
      Specified by:
      createParserRequestBuilder in class ClingSupport