diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27b226b1f..f5810f4da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,9 +27,8 @@ jobs: with: distribution: 'temurin' java-version: ${{ matrix.java }} - cache: 'maven' - name: Build with Maven - run: mvn --no-transfer-progress -B -T 8 install + run: mvn --no-transfer-progress -B -T 1 install - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v1 if: ${{ runner.os != 'Windows' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78d4ac823..ba610f0c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,6 @@ jobs: - name: Setup Java uses: actions/setup-java@v4 with: - cache: 'maven' distribution: 'temurin' java-version: 21 server-id: ossrh diff --git a/docs/src/site/markdown/servlet/create_a_faces_application.md b/docs/src/site/markdown/servlet/create_a_faces_application.md index a7146caff..d58a86c9f 100644 --- a/docs/src/site/markdown/servlet/create_a_faces_application.md +++ b/docs/src/site/markdown/servlet/create_a_faces_application.md @@ -27,22 +27,26 @@ create the ```pom.xml``` file with the content as below. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - cloud.piranha.guides.servlet + cloud.piranha.test.servlet faces 24.10.0-SNAPSHOT war Create a Jakarta Faces application - 21 + 5.11.0 - 3.13.0 - 3.5.0 - 3.4.0 4.0.7 + 5.1.3.Final + + 21 servlet 24.9.0 UTF-8 - 5.1.3.Final + + 3.6.0 + 3.13.0 + 3.5.0 + 3.4.0 @@ -107,6 +111,7 @@ create the ```pom.xml``` file with the content as below. servlet + ${httpPort} @@ -129,6 +134,12 @@ create the ```pom.xml``` file with the content as below. + + 1 + + ${httpPort} + + org.apache.maven.plugins @@ -138,6 +149,25 @@ create the ```pom.xml``` file with the content as below. false + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + reserve-network-port + + reserve-network-port + + package + + + httpPort + + + + + @@ -254,6 +284,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; public class HelloIT { + + private String portNumber = System.getProperty("httpPort"); @Test public void testHelloFacesXhtml() throws Exception { @@ -263,7 +295,7 @@ public class HelloIT { .followRedirects(ALWAYS) .build(); HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/faces/hellofaces.xhtml")) + .newBuilder(new URI("http://localhost:" + portNumber + "/faces/hellofaces.xhtml")) .build(); HttpResponse response = client.send(request, BodyHandlers.ofString()); assertTrue(response.body().contains("Hello from Jakarta Faces!")); diff --git a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StopMojo.java b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StopMojo.java index 4cce2e2bd..49e148b81 100644 --- a/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StopMojo.java +++ b/maven/plugin/src/main/java/cloud/piranha/maven/plugin/StopMojo.java @@ -63,7 +63,7 @@ public class StopMojo extends AbstractMojo { */ public StopMojo() { } - + @Override public void execute() throws MojoExecutionException { if (!skip) { @@ -73,7 +73,7 @@ public void execute() throws MojoExecutionException { */ File pidFile = new File(runtimeDirectory, "tmp/piranha.pid"); String pid = ""; - + if (pidFile.exists()) { pid = Files.readString(pidFile.toPath()); } @@ -98,6 +98,21 @@ public void execute() throws MojoExecutionException { * If the process is still active destroy it forcibly. */ ProcessHandle.of(Long.parseLong(pid.trim())).ifPresent(p -> { + int count = 0; + System.out.print("Waiting for Piranha to stop "); + while (p.isAlive()) { + try { + Thread.sleep(1000); + count++; + System.out.print("."); + } catch (InterruptedException ie) { + } + if (count == 60) { + break; + } + } + System.out.println(); + if (p.isAlive()) { System.err.println("Process still alive, destroying forcibly"); p.destroyForcibly(); diff --git a/test/servlet/faces/pom.xml b/test/servlet/faces/pom.xml index ddd7acf39..6096d8e81 100644 --- a/test/servlet/faces/pom.xml +++ b/test/servlet/faces/pom.xml @@ -15,7 +15,7 @@ 1. Drop the parent part below 2. Change the name of the project to read 'Create a Jakarta Faces application' - 3. Change the version to the latest released version of Piranha + 3. Change the piranha.version to the latest released version of Piranha --> @@ -29,16 +29,20 @@ war Piranha - Test - Servlet - Jakarta Faces application - 21 + 5.11.0 - 3.13.0 - 3.5.0 - 3.4.0 4.0.7 + 5.1.3.Final + + 21 servlet - 24.9.0 + ${project.version} UTF-8 - 5.1.3.Final + + 3.6.0 + 3.13.0 + 3.5.0 + 3.4.0 @@ -102,7 +106,8 @@ - servlet + ${piranha.distribution} + ${httpPort} @@ -125,6 +130,12 @@ + + 1 + + ${httpPort} + + org.apache.maven.plugins @@ -134,6 +145,25 @@ false + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + reserve-network-port + + reserve-network-port + + package + + + httpPort + + + + + diff --git a/test/servlet/faces/src/test/java/hello/HelloIT.java b/test/servlet/faces/src/test/java/hello/HelloIT.java index 444e4a805..33a5b0a7c 100644 --- a/test/servlet/faces/src/test/java/hello/HelloIT.java +++ b/test/servlet/faces/src/test/java/hello/HelloIT.java @@ -11,6 +11,8 @@ import org.junit.jupiter.api.Test; public class HelloIT { + + private String portNumber = System.getProperty("httpPort"); @Test public void testHelloFacesXhtml() throws Exception { @@ -20,7 +22,7 @@ public void testHelloFacesXhtml() throws Exception { .followRedirects(ALWAYS) .build(); HttpRequest request = HttpRequest - .newBuilder(new URI("http://localhost:8080/faces/hellofaces.xhtml")) + .newBuilder(new URI("http://localhost:" + portNumber + "/faces/hellofaces.xhtml")) .build(); HttpResponse response = client.send(request, BodyHandlers.ofString()); assertTrue(response.body().contains("Hello from Jakarta Faces!")); diff --git a/test/servlet/pom.xml b/test/servlet/pom.xml index f7b2258f0..fad0616fb 100644 --- a/test/servlet/pom.xml +++ b/test/servlet/pom.xml @@ -15,6 +15,21 @@ Piranha - Test - Servlet - Project + + + + cloud.piranha.dist + piranha-dist-servlet + ${project.version} + pom + provided + + faces hello