public final class JarRunner extends Object
Constructor and Description |
---|
JarRunner(Parameters parameters)
Prepares a command (in form of an internal
ProcessBuilder ) to launch
a new JVM based on a given artifact with optional arguments. |
Modifier and Type | Method and Description |
---|---|
void |
execute()
Launches a new JVM based on the instances command.
|
String |
getCommandLine()
Returns a command to launch this
JarRunner . |
Parameters |
getParameters()
Parameters object maintaining the injected system objects and user arguments
of
RunMojo |
ProcessBuilder |
getProcessBuilder()
The command prepared to launch the artifact in a new JVM
|
public JarRunner(Parameters parameters) throws org.eclipse.aether.resolution.DependencyResolutionException, org.apache.maven.plugin.MojoFailureException, IOException
ProcessBuilder
) to launch
a new JVM based on a given artifact with optional arguments.
The given artifacts dependencies are resolved and a fully qualified class path is created.
The main class to execute can either be specified by argument or is taken from the artifacts JAR.
parameters
- the parameters used to create the commandorg.eclipse.aether.resolution.DependencyResolutionException
- if resolving dependencies failedIOException
- if any IO failure occurredorg.apache.maven.plugin.MojoFailureException
- either if no main class is given and
the artifacts JAR does not contain a
main class in its manifest or the
started application stopped with an
exit value not equal to zeropublic void execute() throws IOException
IOException
- if any IO failure occurredpublic String getCommandLine()
JarRunner
.
The results of this method depend on the Operating System, as command line arguments on Unix and Windows are quoted and escaped differently.
public Parameters getParameters()
RunMojo
public ProcessBuilder getProcessBuilder()
Copyright © 2025. All rights reserved.