|
|
|
|
@ -80,12 +80,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -80,12 +80,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private ToolchainManager toolchainManager; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Add maven resources to the classpath directly, this allows live in-place |
|
|
|
|
* editing of resources. Duplicate resources are removed from |
|
|
|
|
* {@code target/classes} to prevent them from appearing twice if |
|
|
|
|
* {@code ClassLoader.getResources()} is called. Please consider adding |
|
|
|
|
* {@code spring-boot-devtools} to your project instead as it provides this |
|
|
|
|
* feature and many more. |
|
|
|
|
* Add maven resources to the classpath directly, this allows live in-place editing of |
|
|
|
|
* resources. Duplicate resources are removed from {@code target/classes} to prevent |
|
|
|
|
* them from appearing twice if {@code ClassLoader.getResources()} is called. Please |
|
|
|
|
* consider adding {@code spring-boot-devtools} to your project instead as it provides |
|
|
|
|
* this feature and many more. |
|
|
|
|
* |
|
|
|
|
* @since 1.0.0 |
|
|
|
|
*/ |
|
|
|
|
@ -109,8 +108,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -109,8 +108,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private boolean noverify = false; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Current working directory to use for the application. If not specified, |
|
|
|
|
* basedir will be used. |
|
|
|
|
* Current working directory to use for the application. If not specified, basedir |
|
|
|
|
* will be used. |
|
|
|
|
* |
|
|
|
|
* @since 1.5.0 |
|
|
|
|
*/ |
|
|
|
|
@ -118,9 +117,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -118,9 +117,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private File workingDirectory; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* JVM arguments that should be associated with the forked process used to run |
|
|
|
|
* the application. On command line, make sure to wrap multiple values between |
|
|
|
|
* quotes. |
|
|
|
|
* JVM arguments that should be associated with the forked process used to run the |
|
|
|
|
* application. On command line, make sure to wrap multiple values between quotes. |
|
|
|
|
* |
|
|
|
|
* @since 1.1.0 |
|
|
|
|
*/ |
|
|
|
|
@ -136,8 +134,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -136,8 +134,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private Map<String, String> systemPropertyVariables; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List of Environment variables that should be associated with the forked |
|
|
|
|
* process used to run the application. |
|
|
|
|
* List of Environment variables that should be associated with the forked process |
|
|
|
|
* used to run the application. |
|
|
|
|
* |
|
|
|
|
* @since 2.1.0 |
|
|
|
|
*/ |
|
|
|
|
@ -154,8 +152,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -154,8 +152,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Arguments from the command line that should be passed to the application. Use |
|
|
|
|
* spaces to separate multiple arguments and make sure to wrap multiple values |
|
|
|
|
* between quotes. When specified, takes precedence over {@link #arguments}. |
|
|
|
|
* spaces to separate multiple arguments and make sure to wrap multiple values between |
|
|
|
|
* quotes. When specified, takes precedence over {@link #arguments}. |
|
|
|
|
* |
|
|
|
|
* @since 2.2.3 |
|
|
|
|
*/ |
|
|
|
|
@ -164,8 +162,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -164,8 +162,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The spring profiles to activate. Convenience shortcut of specifying the |
|
|
|
|
* 'spring.profiles.active' argument. On command line use commas to separate |
|
|
|
|
* multiple profiles. |
|
|
|
|
* 'spring.profiles.active' argument. On command line use commas to separate multiple |
|
|
|
|
* profiles. |
|
|
|
|
* |
|
|
|
|
* @since 1.3.0 |
|
|
|
|
*/ |
|
|
|
|
@ -173,8 +171,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -173,8 +171,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private String[] profiles; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The name of the main class. If not specified the first compiled class found |
|
|
|
|
* that contains a 'main' method will be used. |
|
|
|
|
* The name of the main class. If not specified the first compiled class found that |
|
|
|
|
* contains a 'main' method will be used. |
|
|
|
|
* |
|
|
|
|
* @since 1.0.0 |
|
|
|
|
*/ |
|
|
|
|
@ -182,8 +180,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -182,8 +180,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private String mainClass; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Additional classpath elements that should be added to the classpath. An |
|
|
|
|
* element can be a directory with classes and resources or a jar file. |
|
|
|
|
* Additional classpath elements that should be added to the classpath. An element can |
|
|
|
|
* be a directory with classes and resources or a jar file. |
|
|
|
|
* |
|
|
|
|
* @since 3.2.0 |
|
|
|
|
*/ |
|
|
|
|
@ -191,8 +189,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -191,8 +189,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
private String[] additionalClasspathElements; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Directory containing the classes and resource files that should be used to |
|
|
|
|
* run the application. |
|
|
|
|
* Directory containing the classes and resource files that should be used to run the |
|
|
|
|
* application. |
|
|
|
|
* |
|
|
|
|
* @since 1.0.0 |
|
|
|
|
*/ |
|
|
|
|
@ -224,10 +222,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -224,10 +222,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns the directories that contain the application's classes and resources. |
|
|
|
|
* When the application's main class has not been configured, each directory is |
|
|
|
|
* searched in turn for an appropriate main class. |
|
|
|
|
* |
|
|
|
|
* Returns the directories that contain the application's classes and resources. When |
|
|
|
|
* the application's main class has not been configured, each directory is searched in |
|
|
|
|
* turn for an appropriate main class. |
|
|
|
|
* @return the directories that contain the application's classes and resources |
|
|
|
|
* @since 3.1.0 |
|
|
|
|
*/ |
|
|
|
|
@ -256,7 +253,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -256,7 +253,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Run the application. |
|
|
|
|
* |
|
|
|
|
* @param processExecutor the {@link JavaProcessExecutor} to use |
|
|
|
|
* @param workingDirectory the working directory of the forked JVM |
|
|
|
|
* @param args the arguments (JVM arguments and application arguments) |
|
|
|
|
@ -270,7 +266,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -270,7 +266,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Resolve the application arguments to use. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RunArguments} defining the application arguments |
|
|
|
|
*/ |
|
|
|
|
protected RunArguments resolveApplicationArguments() { |
|
|
|
|
@ -282,7 +277,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -282,7 +277,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Resolve the environment variables to use. |
|
|
|
|
* |
|
|
|
|
* @return an {@link EnvVariables} defining the environment variables |
|
|
|
|
*/ |
|
|
|
|
protected EnvVariables resolveEnvVariables() { |
|
|
|
|
@ -303,15 +297,15 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -303,15 +297,15 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Resolve the JVM arguments to use. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RunArguments} defining the JVM arguments |
|
|
|
|
*/ |
|
|
|
|
protected RunArguments resolveJvmArguments() { |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (this.systemPropertyVariables != null) { |
|
|
|
|
stringBuilder.append(this.systemPropertyVariables.entrySet().stream() |
|
|
|
|
.map((e) -> SystemPropertyFormatter.format(e.getKey(), e.getValue())) |
|
|
|
|
.collect(Collectors.joining(" "))); |
|
|
|
|
stringBuilder.append(this.systemPropertyVariables.entrySet() |
|
|
|
|
.stream() |
|
|
|
|
.map((e) -> SystemPropertyFormatter.format(e.getKey(), e.getValue())) |
|
|
|
|
.collect(Collectors.joining(" "))); |
|
|
|
|
} |
|
|
|
|
if (this.jvmArguments != null) { |
|
|
|
|
stringBuilder.append(" ").append(this.jvmArguments); |
|
|
|
|
@ -360,7 +354,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -360,7 +354,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
getLog().debug("Classpath for forked process: " + classpath); |
|
|
|
|
} |
|
|
|
|
args.addAll(classpath.args(true)); |
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) { |
|
|
|
|
throw new MojoExecutionException("Could not build classpath", ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -373,7 +368,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@@ -373,7 +368,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|
|
|
|
addProjectClasses(urls); |
|
|
|
|
addDependencies(urls); |
|
|
|
|
return urls.toArray(new URL[0]); |
|
|
|
|
} catch (IOException ex) { |
|
|
|
|
} |
|
|
|
|
catch (IOException ex) { |
|
|
|
|
throw new MojoExecutionException("Unable to build classpath", ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|