From 8e67ae7113314b282d97bc3fe802f18b3f00846b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 3 Mar 2021 15:14:28 +0100 Subject: [PATCH] Fix fallback fork value for spring-boot:stop This commit harmonizes the fallback value that spring-boot:stop goal should use if no information is available in the current context. Closes gh-25472 --- .../org/springframework/boot/maven/StopMojo.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java index b72f859584..5afb6b8f30 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,9 +49,10 @@ public class StopMojo extends AbstractMojo { private MavenProject project; /** - * Flag to indicate if process to stop was forked. By default, the value is inherited - * from the {@link MavenProject}. If it is set, it must match the value used to - * {@link StartMojo start} the process. + * Flag to indicate if the process to stop was forked. By default, the value is + * inherited from the {@link MavenProject} with a fallback on the default fork value + * ({@code true}). If it is set, it must match the value used to {@link StartMojo + * start} the process. * @since 1.3.0 */ @Parameter(property = "spring-boot.stop.fork") @@ -103,8 +104,11 @@ public class StopMojo extends AbstractMojo { if (this.fork != null) { return this.fork; } - String property = this.project.getProperties().getProperty("_spring.boot.fork.enabled"); - return Boolean.parseBoolean(property); + String forkFromStart = this.project.getProperties().getProperty("_spring.boot.fork.enabled"); + if (forkFromStart != null) { + return Boolean.parseBoolean(forkFromStart); + } + return true; } private void stopForkedProcess() throws IOException, MojoFailureException, MojoExecutionException {