From 793bf000361a9e48492e70bd38ca9c81b3c58815 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Tue, 24 Sep 2024 17:44:30 -0500 Subject: [PATCH] Fixes #4013 - Add startTimeout to Piranha Maven plugin --- .../main/java/cloud/piranha/maven/plugin/StartMojo.java | 9 ++++++++- test/micro/helloworld/pom.xml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StartMojo.java b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StartMojo.java index 0cbb100ba..1fe86d7ff 100644 --- a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StartMojo.java +++ b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StartMojo.java @@ -34,6 +34,7 @@ import org.apache.maven.plugin.MojoExecutionException; import static org.apache.maven.plugins.annotations.LifecyclePhase.NONE; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; /** * This goal will deploy your web application and start Piranha in a separate @@ -44,6 +45,12 @@ @Mojo(name = "start", defaultPhase = NONE) public class StartMojo extends BaseMojo { + /** + * Stores the start timeout (in seconds). + */ + @Parameter(defaultValue = "600", property = "piranha.startTimeout", required = false) + protected Integer startTimeout; + /** * Default constructor. */ @@ -161,7 +168,7 @@ private void startPiranha() throws IOException { System.out.print("."); } catch (InterruptedException ie) { } - if (count == 600) { + if (count == startTimeout) { System.out.println(); System.out.println("Warning, PID file not seen!"); break; diff --git a/test/micro/helloworld/pom.xml b/test/micro/helloworld/pom.xml index 9cbac3003..0ab676c42 100644 --- a/test/micro/helloworld/pom.xml +++ b/test/micro/helloworld/pom.xml @@ -69,6 +69,7 @@ ${piranha.distribution} ${httpPort} + 30