Merge branch '2.7.x'
This commit is contained in:
commit
c21b4a5280
|
@ -9,13 +9,13 @@ The plugin includes a run goal which can be used to launch your application from
|
|||
|
||||
Application arguments can be specified using the `arguments` parameter, see <<run.examples.using-application-arguments,using application arguments>> for more details.
|
||||
|
||||
By default the application is executed in a forked process and setting properties on the command-line will not affect the application.
|
||||
The application is executed in a forked process and setting properties on the command-line will not affect the application.
|
||||
If you need to specify some JVM arguments (that is for debugging purposes), you can use the `jvmArguments` parameter, see <<run.examples.debug,Debug the application>> for more details.
|
||||
There is also explicit support for <<run.examples.system-properties,system properties>> and <<run.examples.environment-variables,environment variables>>.
|
||||
|
||||
As enabling a profile is quite common, there is dedicated `profiles` property that offers a shortcut for `-Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev"`, see <<run.examples.specify-active-profiles,Specify active profiles>>.
|
||||
|
||||
Although this is not recommended, it is possible to execute the application directly from the Maven JVM by disabling the `fork` property.
|
||||
Although this is not recommended (and deprecated), it is possible to execute the application directly from the Maven JVM by disabling the `fork` property.
|
||||
Doing so means that the `jvmArguments`, `systemPropertyVariables`, `environmentVariables` and `agents` options are ignored.
|
||||
|
||||
Spring Boot `devtools` is a module to improve the development-time experience when working on Spring Boot applications.
|
||||
|
@ -73,7 +73,7 @@ include::goals/run.adoc[leveloffset=+1]
|
|||
|
||||
[[run.examples.debug]]
|
||||
=== Debug the Application
|
||||
By default, the `run` goal runs your application in a forked process.
|
||||
The `run` goal runs your application in a forked process.
|
||||
If you need to debug it, you should add the necessary JVM arguments to enable remote debugging.
|
||||
The following configuration suspend the process until a debugger has joined on port 5005:
|
||||
|
||||
|
|
|
@ -192,12 +192,14 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||
private File classesDirectory;
|
||||
|
||||
/**
|
||||
* Flag to indicate if the run processes should be forked. Disabling forking will
|
||||
* disable some features such as an agent, custom JVM arguments, devtools or
|
||||
* specifying the working directory to use.
|
||||
* Deprecated. Flag to indicate if the run processes should be forked. Disabling
|
||||
* forking will disable some features such as an agent, custom JVM arguments, devtools
|
||||
* or specifying the working directory to use.
|
||||
* @since 1.2.0
|
||||
* @deprecated since 2.7.0 for removal in 3.0.0 with no replacement
|
||||
*/
|
||||
@Parameter(property = "spring-boot.run.fork", defaultValue = "true")
|
||||
@Deprecated
|
||||
private boolean fork;
|
||||
|
||||
/**
|
||||
|
@ -226,7 +228,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||
/**
|
||||
* Specify if the application process should be forked.
|
||||
* @return {@code true} if the application process should be forked
|
||||
* @deprecated since 2.7.0 for removal in 3.0.0 with no replacement
|
||||
*/
|
||||
@Deprecated
|
||||
protected boolean isFork() {
|
||||
return this.fork;
|
||||
}
|
||||
|
@ -244,6 +248,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||
return this.workingDirectory != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void run(String startClassName) throws MojoExecutionException, MojoFailureException {
|
||||
boolean fork = isFork();
|
||||
this.project.getProperties().setProperty("_spring.boot.fork.enabled", Boolean.toString(fork));
|
||||
|
@ -304,7 +309,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||
* @param arguments the class arguments
|
||||
* @throws MojoExecutionException in case of MOJO execution errors
|
||||
* @throws MojoFailureException in case of MOJO failures
|
||||
* @deprecated since 2.7.0 for removal in 3.0.0 with no replacement
|
||||
*/
|
||||
@Deprecated
|
||||
protected abstract void runWithMavenJvm(String startClassName, String... arguments)
|
||||
throws MojoExecutionException, MojoFailureException;
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ public class RunMojo extends AbstractRunMojo {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected RunArguments resolveJvmArguments() {
|
||||
RunArguments jvmArguments = super.resolveJvmArguments();
|
||||
if (isFork() && this.optimizedLaunch) {
|
||||
|
@ -114,6 +115,7 @@ public class RunMojo extends AbstractRunMojo {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
protected void runWithMavenJvm(String startClassName, String... arguments) throws MojoExecutionException {
|
||||
IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName);
|
||||
Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName, arguments), "main");
|
||||
|
|
|
@ -113,6 +113,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected RunArguments resolveApplicationArguments() {
|
||||
RunArguments applicationArguments = super.resolveApplicationArguments();
|
||||
applicationArguments.getArgs().addLast(ENABLE_MBEAN_PROPERTY);
|
||||
|
@ -123,6 +124,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected RunArguments resolveJvmArguments() {
|
||||
RunArguments jvmArguments = super.resolveJvmArguments();
|
||||
if (isFork()) {
|
||||
|
@ -138,6 +140,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
protected void runWithMavenJvm(String startClassName, String... arguments) throws MojoExecutionException {
|
||||
IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName);
|
||||
Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName, arguments),
|
||||
|
@ -171,6 +174,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||
"Spring application did not start before the configured timeout (" + (wait * maxAttempts) + "ms");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void waitForSpringApplication() throws MojoFailureException, MojoExecutionException {
|
||||
try {
|
||||
if (isFork()) {
|
||||
|
|
Loading…
Reference in New Issue