Skip to content

Commit 8e67ae7

Browse files
committed
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
1 parent 14948cb commit 8e67ae7

File tree

1 file changed

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

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,9 +49,10 @@ public class StopMojo extends AbstractMojo {
4949
private MavenProject project;
5050

5151
/**
52-
* Flag to indicate if process to stop was forked. By default, the value is inherited
53-
* from the {@link MavenProject}. If it is set, it must match the value used to
54-
* {@link StartMojo start} the process.
52+
* Flag to indicate if the process to stop was forked. By default, the value is
53+
* inherited from the {@link MavenProject} with a fallback on the default fork value
54+
* ({@code true}). If it is set, it must match the value used to {@link StartMojo
55+
* start} the process.
5556
* @since 1.3.0
5657
*/
5758
@Parameter(property = "spring-boot.stop.fork")
@@ -103,8 +104,11 @@ private boolean isForked() {
103104
if (this.fork != null) {
104105
return this.fork;
105106
}
106-
String property = this.project.getProperties().getProperty("_spring.boot.fork.enabled");
107-
return Boolean.parseBoolean(property);
107+
String forkFromStart = this.project.getProperties().getProperty("_spring.boot.fork.enabled");
108+
if (forkFromStart != null) {
109+
return Boolean.parseBoolean(forkFromStart);
110+
}
111+
return true;
108112
}
109113

110114
private void stopForkedProcess() throws IOException, MojoFailureException, MojoExecutionException {

0 commit comments

Comments
 (0)