Class RunUtils

java.lang.Object
org.netbeans.modules.maven.api.execute.RunUtils

public final class RunUtils extends Object
Utility method for executing a maven build, using the RunConfig.
  • Method Details

    • run

      @CheckForNull public static org.openide.execution.ExecutorTask run(RunConfig config)
      Runs Maven after checking prerequisites.
      Parameters:
      config - a run configuration (try createRunConfig(java.lang.String, org.netbeans.api.project.Project, org.netbeans.spi.project.ProjectConfiguration, org.openide.util.Lookup))
      Returns:
      a task to track progress, or null if prerequisites were not satisfied
      Since:
      2.18
      See Also:
    • executeMaven

      public static org.openide.execution.ExecutorTask executeMaven(RunConfig config)
      Execute maven build in NetBeans execution engine. Most callers should rather use run(org.netbeans.modules.maven.api.execute.RunConfig) as this variant does no (non-late-bound) prerequisite checks. It is mostly suitable for cases where you need full control by the caller over the config, or want to rerun a previous execution.
      Parameters:
      config -
      Returns:
    • createRunConfig

      public static RunConfig createRunConfig(String action, org.netbeans.api.project.Project prj, org.netbeans.spi.project.ProjectConfiguration c, org.openide.util.Lookup lookup)
      Creates a RunConfig for the specified project action. Project configuration to be used can be also specified, which affects potentially the action's mapping and/or properties. If null is passed, the current/active configuration is used. If applied on non-Maven project, the method returns null, as well as if the requested action does not exist in the project or its requested (or active) configuration.
      Parameters:
      action - project action name
      prj - the project
      c - the configuration to use, use null for the active one.
      lookup - lookup that becomes available to the action provider for possible further data / options
      Returns:
      configured RunConfig suitable for execution or null if the project is not maven, or action is unavailable.
      Since:
      2.157
    • createRunConfig

      public static RunConfig createRunConfig(File execDir, org.netbeans.api.project.Project prj, String displayName, List<String> goals)
    • cloneRunConfig

      public static RunConfig cloneRunConfig(RunConfig original)
      return a new instance of runconfig by the template passed as parameter
      Parameters:
      original -
      Returns:
      Since:
      2.40
    • isCompileOnSaveEnabled

      public static boolean isCompileOnSaveEnabled(org.netbeans.api.project.Project prj)
    • isCompileOnSaveEnabled

      public static boolean isCompileOnSaveEnabled(RunConfig config)
    • hasApplicationCompileOnSaveEnabled

      @Deprecated public static boolean hasApplicationCompileOnSaveEnabled(org.netbeans.api.project.Project prj)
      Deprecated.
      Parameters:
      prj -
      Returns:
      true if compile on save is allowed for running the application.
    • hasApplicationCompileOnSaveEnabled

      @Deprecated public static boolean hasApplicationCompileOnSaveEnabled(RunConfig config)
      Deprecated.
      Parameters:
      config -
      Returns:
      true if compile on save is allowed for running the application.
    • hasTestCompileOnSaveEnabled

      @Deprecated public static boolean hasTestCompileOnSaveEnabled(org.netbeans.api.project.Project prj)
      Deprecated.
      Parameters:
      prj -
      Returns:
      true if compile on save is allowed for running tests.
    • hasTestCompileOnSaveEnabled

      @Deprecated public static boolean hasTestCompileOnSaveEnabled(RunConfig config)
      Deprecated.
      Parameters:
      config -
      Returns:
      true if compile on save is allowed for running tests.