profile
viewpoint

Ask questionsSpring Boot - Maven Plugin shutdown broken

As of 2.2.0 the shutdown of a spring-boot application is broken and results in a Build Failure when executed.

I ran mvnw clean install package spring-boot:run as a command.

In attachment the executable file of a boot from https://start.spring.io/ and the resulted build fail. I ran with Java 8, and the Maven wrapper included in the project.

output.txt

spring-projects/spring-boot

Answer questions wilkinsona

Thanks. The problem appears to be specific to Windows. On macOS CTRL+C shuts the app down gently and the build completes successfully:

[INFO] --- spring-boot-maven-plugin:2.2.1.RELEASE:run (default-cli) @ demo ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.1.RELEASE)

2019-11-08 09:57:55.340  INFO 49237 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on Andys-MacBook-Pro.local with PID 49237 (/Users/awilkinson/Downloads/demo-2/target/classes started by awilkinson in /Users/awilkinson/Downloads/demo-2)
2019-11-08 09:57:55.342  INFO 49237 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-11-08 09:57:55.840  INFO 49237 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-08 09:57:55.846  INFO 49237 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-08 09:57:55.846  INFO 49237 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-08 09:57:55.888  INFO 49237 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-08 09:57:55.888  INFO 49237 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 521 ms
2019-11-08 09:57:55.977  INFO 49237 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-08 09:57:56.066  INFO 49237 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-08 09:57:56.068  INFO 49237 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.917 seconds (JVM running for 1.16)
^C2019-11-08 09:57:57.852  INFO 49237 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.357 s
[INFO] Finished at: 2019-11-08T09:57:57Z
[INFO] ------------------------------------------------------------------------

On Windows the app seems to be killed rather than being shut down (the shutdown hook does not run) and the build then ends in failure:

[INFO] --- spring-boot-maven-plugin:2.2.1.RELEASE:run (default-cli) @ demo ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.1.RELEASE)

2019-11-08 10:05:16.915  INFO 4676 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on WIN-MV32EG1PCS7 with PID 4676 (started by Andy Wilkinson in C:\Users\Andy Wilkinson\Desktop\demo)
2019-11-08 10:05:16.915  INFO 4676 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-11-08 10:05:17.789  INFO 4676 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-08 10:05:17.804  INFO 4676 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-08 10:05:17.804  INFO 4676 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-08 10:05:17.867  INFO 4676 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-08 10:05:17.867  INFO 4676 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 905ms
2019-11-08 10:05:18.023  INFO 4676 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-08 10:05:18.241  INFO 4676 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-08 10:05:18.257  INFO 4676 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 1.634 seconds (JVM running for 1.954)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:29 min
[INFO] Finished at: 2019-11-08T10:05:33Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin :2.2.1.RELEASE:run (default-cli) on project demo: Application finished with exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
useful!
source:https://uonfu.com/
Github User Rank List