Class MavenCommandLineExecutor
java.lang.Object
org.netbeans.modules.maven.execute.OutputTabMaintainer<AbstractMavenExecutor.TabContext>
org.netbeans.modules.maven.execute.AbstractMavenExecutor
org.netbeans.modules.maven.execute.MavenCommandLineExecutor
- All Implemented Interfaces:
Runnable
,MavenExecutor
,org.openide.util.Cancellable
support for executing maven, externally on the command line.
Since 2/1.144, the
The example will append
LateBoundPrerequisitesChecker
registered in Maven projects for JAR packaging by default supports
ExplicitProcessParameters
API. The caller of the execute-type action can request to append or replace VM or user
application parameters. The parameters recorded in the POM.xml or NetBeans action mappings are augmented according to that
instructions:
- launcherArgs are mapped to VM arguments (precede main class name)
- args are mapped to user application arguments (after main class name)
StartupExtender
API are not affected by this feature.
Example use:
// get action provider:
ActionProvider projectActionProvider = prj.getLookup().lookup(ActionProvider.class);
// create explicit additional parameters instruction:
ExplicitProcessParameters params = ExplicitProcessParameters.builder().
launcherArg("-DvmArg2=2").
arg("paramY").
build();
// pass explicit parameters to the Run action:
projectActionProvider.invokeAction(ActionProvider.COMMAND_RUN, Lookups.fixed(params));
-DvmArg2=2
to VM arguments and replaces all user
program arguments with "paramY"
. Append mode can be controlled using ExplicitProcessParameters.Builder.replaceArgs(boolean)
or
ExplicitProcessParameters.Builder.replaceLauncherArgs(boolean)
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Hooks for tests to mock the Maven execution.Nested classes/interfaces inherited from class org.netbeans.modules.maven.execute.AbstractMavenExecutor
AbstractMavenExecutor.MavenItem, AbstractMavenExecutor.OptionsAction, AbstractMavenExecutor.ResumeFromFinder, AbstractMavenExecutor.TabContext
-
Field Summary
Fields inherited from class org.netbeans.modules.maven.execute.AbstractMavenExecutor
config, item, SEMAPHORE, task
Fields inherited from class org.netbeans.modules.maven.execute.OutputTabMaintainer
io
-
Constructor Summary
ConstructorsConstructorDescriptionMavenCommandLineExecutor
(RunConfig conf, org.openide.windows.InputOutput io, AbstractMavenExecutor.TabContext tc) -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel()
static org.openide.execution.ExecutorTask
executeMaven
(RunConfig config, org.openide.windows.InputOutput io, AbstractMavenExecutor.TabContext tc) Execute maven build in NetBeans execution engine.void
run()
not to be called directly..Methods inherited from class org.netbeans.modules.maven.execute.AbstractMavenExecutor
actionStatesAtFinish, actionStatesAtStart, addInitialMessage, createContext, createNewTabActions, processInitialMessage, reassignAdditionalContext, setTask, tabContextType
Methods inherited from class org.netbeans.modules.maven.execute.OutputTabMaintainer
createInputOutput, getInputOutput, markFreeTab
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.netbeans.modules.maven.execute.MavenExecutor
getInputOutput
-
Constructor Details
-
MavenCommandLineExecutor
public MavenCommandLineExecutor(RunConfig conf, org.openide.windows.InputOutput io, AbstractMavenExecutor.TabContext tc)
-
-
Method Details
-
executeMaven
public static org.openide.execution.ExecutorTask executeMaven(RunConfig config, org.openide.windows.InputOutput io, AbstractMavenExecutor.TabContext tc) Execute maven build in NetBeans execution engine. Most callers should rather userun()
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
-io
-null
or InputOutput to reuse for output of the executiontc
- tab context to use ornull
- Returns:
- Since:
- 2.113
-
run
public void run()not to be called directly.. use execute(); -
cancel
public boolean cancel()
-