From 7dbfd95c5fa2560a0be77fd4c18851d293165ce6 Mon Sep 17 00:00:00 2001 From: Scott Kurz Date: Wed, 9 Aug 2023 15:54:18 -0400 Subject: [PATCH] Run war:war in ShutdownHook Signed-off-by: Scott Kurz --- .../io/openliberty/tools/maven/server/DevMojo.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java index 02a42d1ee..4abef06ef 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java @@ -1424,6 +1424,18 @@ private void doDevMode() throws MojoExecutionException { } util.addShutdownHook(executor); + + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + try { + runMojoForProject("org.apache.maven.plugins", "maven-war-plugin", "war", project); + } catch (MojoExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); try { util.startServer();