Skip to content

Commit 569b850

Browse files
Dos Debugsnicoll
Dos Debug
authored andcommitted
Default to optimized launch of the JVM when using spring-boot:run
See spring-projectsgh-16941
1 parent d8e5169 commit 569b850

File tree

1 file changed

+9
-0
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven

1 file changed

+9
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java

+9
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
import java.io.File;
2020
import java.net.URL;
2121
import java.net.URLClassLoader;
22+
import java.util.Collections;
2223
import java.util.List;
2324
import java.util.Map;
2425

2526
import org.apache.maven.plugin.MojoExecutionException;
2627
import org.apache.maven.plugins.annotations.Execute;
2728
import org.apache.maven.plugins.annotations.LifecyclePhase;
2829
import org.apache.maven.plugins.annotations.Mojo;
30+
import org.apache.maven.plugins.annotations.Parameter;
2931
import org.apache.maven.plugins.annotations.ResolutionScope;
3032

3133
import org.springframework.boot.loader.tools.JavaExecutable;
@@ -53,6 +55,9 @@ public class RunMojo extends AbstractRunMojo {
5355
*/
5456
private Boolean hasDevtools;
5557

58+
@Parameter(property = "optimizedLaunch", defaultValue = "true")
59+
private boolean optimizedLaunch = true;
60+
5661
@Override
5762
@Deprecated
5863
protected boolean enableForkByDefault() {
@@ -70,6 +75,10 @@ protected void logDisabledFork() {
7075
@Override
7176
protected void runWithForkedJvm(File workingDirectory, List<String> args,
7277
Map<String, String> environmentVariables) throws MojoExecutionException {
78+
if (this.optimizedLaunch) {
79+
String[] optimizedLaunchArgs = { "-Xverify:none", "-XX:TieredStopAtLevel=1" };
80+
Collections.addAll(args, optimizedLaunchArgs);
81+
}
7382
int exitCode = forkJvm(workingDirectory, args, environmentVariables);
7483
if (exitCode == 0 || exitCode == EXIT_CODE_SIGINT) {
7584
return;

0 commit comments

Comments
 (0)