diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4328501c..8c66de01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,17 @@ on: push: branches: - '**' + paths-ignore: + - 'examples/**' pull_request: types: [opened, synchronize, reopened, ready_for_review] + paths-ignore: + - 'examples/**' +# Only run the latest job +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true jobs: build: @@ -19,7 +27,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest ] - java: ['11', '17'] + java: ['11', '17', '21'] steps: - uses: actions/checkout@v2 @@ -30,34 +38,36 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: 'maven' - name: Build and Test on ${{ matrix.java }} # Some tests start the server with large default configurations, on Windows CI it has been observed some failure caused by reaching mem limits. run: mvn clean install '-Dtest.jvm.args=-Xms1g -Xmx1g -Dorg.wildfly.logging.skipLogManagerCheck=true' '-Dorg.wildfly.bootable.jar.ci.execution=true' - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: failure() with: name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} path: | !**/bootable-jar-build-artifacts/** - **/surefire-reports/*.txt - - uses: actions/upload-artifact@v2 + **/surefire-reports/ + - uses: actions/upload-artifact@v4 if: failure() with: name: server-logs-${{ matrix.os }}-${{ matrix.java }} path: | !**/bootable-jar-build-artifacts/** **/server.log - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: failure() with: name: devwatch-logs-${{ matrix.os }}-${{ matrix.java }} path: | !**/bootable-jar-build-artifacts/** **/dev-watch-test-output.txt - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: failure() with: name: logs-${{ matrix.os }}-${{ matrix.java }} diff --git a/.github/workflows/examples-ci.yml b/.github/workflows/examples-ci.yml new file mode 100644 index 00000000..39321f73 --- /dev/null +++ b/.github/workflows/examples-ci.yml @@ -0,0 +1,70 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: WildFly JAR Maven Plugin Examples - CI + +on: + push: + branches: + - '**' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +# Only run the latest job +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + build: + name: ${{ matrix.os }}-jdk${{ matrix.java }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest ] + java: ['11', '17', '21'] + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: 'maven' + - name: Build and Test Examples on ${{ matrix.java }} + # We first build the project, then we build the examples + run: | + mvn -B -ntp clean install -DskipTests + cd examples + mvn -B -ntp clean install + - name: Build and Test Examples that require JDK 17 on ${{ matrix.java }} + if: matrix.java != '11' + run: | + cd examples/mdb-rar + mvn -B -ntp clean install + cd ../gradle-mdb-rar + ./gradlew clean build + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} + path: | + !**/bootable-jar-build-artifacts/** + **/surefire-reports/ + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: server-logs-${{ matrix.os }}-${{ matrix.java }} + path: | + !**/bootable-jar-build-artifacts/** + **/server.log + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: logs-${{ matrix.os }}-${{ matrix.java }} + path: | + !**/bootable-jar-build-artifacts/** + **/tests/**/logs/** + diff --git a/examples/arquillian/hollow-jar/README.md b/examples/arquillian/hollow-jar/README.md index 7388efcd..6e53a0f8 100644 --- a/examples/arquillian/hollow-jar/README.md +++ b/examples/arquillian/hollow-jar/README.md @@ -7,9 +7,7 @@ In this scenario, part of the Arquillian test is run as a client The Arquillian XML descriptor is located in _src/test/resources/arquillian.xml_ -Build, test and run +Build and run tests =================== * To build and run tests: `mvn clean verify` -* To run: `mvn wildfly-jar:run` -* Access the application: `http://127.0.0.1:8080/hello` diff --git a/examples/ejb-in-ear/README.md b/examples/ejb-in-ear/README.md index 158c61da..f366fac8 100644 --- a/examples/ejb-in-ear/README.md +++ b/examples/ejb-in-ear/README.md @@ -26,11 +26,11 @@ Build and run on OpenShift * `mvn package -Popenshift` * mkdir os && cp ear/target/ejb-in-ear-bootable.jar os/ -* Import the OpenJDK 11 image to run the Java application, create the image stream and deployment: +* Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: ``` -oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm +oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm -oc new-build --strategy source --binary --image-stream openjdk-11 --name ejb-in-ear-bootable-jar +oc new-build --strategy source --binary --image-stream openjdk-17 --name ejb-in-ear-bootable-jar oc start-build ejb-in-ear-bootable-jar --from-dir ./os/ ``` @@ -38,9 +38,7 @@ oc start-build ejb-in-ear-bootable-jar --from-dir ./os/ The build could take some time to end, so verify its status before creating the application, for example, checks the logs of the build pod. ``` -oc new-app --name ejb-in-ear-bootable-jar-app \ - --env GC_METASPACE_SIZE=96 \ - ejb-in-ear-bootable-jar +oc new-app --name ejb-in-ear-bootable-jar-app ejb-in-ear-bootable-jar oc expose svc/ejb-in-ear-bootable-jar-app ``` diff --git a/examples/ejb-in-war/README.md b/examples/ejb-in-war/README.md index 86720581..477194d5 100644 --- a/examples/ejb-in-war/README.md +++ b/examples/ejb-in-war/README.md @@ -15,11 +15,11 @@ Build and run on OpenShift * mvn package -Popenshift * mkdir os && cp target/ejb-in-war-bootable.jar os/ -* Import the OpenJDK 11 image to run the Java application, create the image stream and deployment: +* Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: ``` -oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm +oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm -oc new-build --strategy source --binary --image-stream openjdk-11 --name ejb-bootable-jar +oc new-build --strategy source --binary --image-stream openjdk-17 --name ejb-bootable-jar oc start-build ejb-bootable-jar --from-dir ./os/ diff --git a/examples/ejb-persistent-clustered-timers/helm.yaml b/examples/ejb-persistent-clustered-timers/helm.yaml index c79a92a1..66f6380e 100644 --- a/examples/ejb-persistent-clustered-timers/helm.yaml +++ b/examples/ejb-persistent-clustered-timers/helm.yaml @@ -1,6 +1,6 @@ build: uri: https://github.com/wildfly-extras/wildfly-jar-maven-plugin.git - ref: 7.0.1.Final + ref: 11.0.0.Beta2 contextDir: examples mode: bootable-jar env: diff --git a/examples/elytron-oidc-client/README.md b/examples/elytron-oidc-client/README.md index ea73be6b..26814583 100644 --- a/examples/elytron-oidc-client/README.md +++ b/examples/elytron-oidc-client/README.md @@ -19,14 +19,14 @@ NB: In order for the deployment to be identified as "secured with OIDC", the `au Initial Steps ======= -* Download the keycloak server from: `https://www.keycloak.org/download` (Quarkus build, 19+) +* Download the keycloak server from: `https://www.keycloak.org/downloads` (24.0.2) * Start the keycloak server to listen on port 8080: `bin/kc.sh start-dev` * Log into the keycloak server admin console (you will possibly be asked to create an initial admin user) : `http://127.0.0.1:8080/` * Create a Realm named `WildFly` * Create a Role named `Users` * Create a User named `demo`, password `demo` * Assign the role `Users` to the user `demo` -* Create a Client named `simple-webapp` with Root URL: `http://127.0.0.1:8090/simple-webapp` and Redirect url: `http://127.0.0.1:8090/simple-webapp/*` +* Create a Client named `simple-webapp` with Root URL: `http://127.0.0.1:8090/simple-webapp` Build and run ======== diff --git a/examples/gradle-mdb-rar/build.gradle b/examples/gradle-mdb-rar/build.gradle index 8b387327..4f1bae0d 100644 --- a/examples/gradle-mdb-rar/build.gradle +++ b/examples/gradle-mdb-rar/build.gradle @@ -18,6 +18,7 @@ java { } jar{ + mustRunAfter("getRAR") archiveBaseName = "gradle-demo" exclude("*.cli") exclude("*properties") @@ -52,7 +53,7 @@ task mavenClean(type: Exec){ } } wrapper{ - gradleVersion = '6.7' + gradleVersion = '8.7' } diff --git a/examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.properties b/examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.properties index 14e30f74..d951fac2 100644 --- a/examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/https/README.md b/examples/https/README.md index c6d725dd..dca13fe6 100644 --- a/examples/https/README.md +++ b/examples/https/README.md @@ -38,11 +38,12 @@ In this example, the keystore is not packaged in the bootable jar but mounted in Steps: * mvn package -Popenshift * mkdir os && cp target/https-bootable.jar os/ -* oc new-build --strategy source --binary --image-stream openjdk11 --name https-test +oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm +* oc new-build --strategy source --binary --image-stream openjdk-17 --name https-test * oc start-build https-test --from-dir ./os/ * oc new-app https-test -* oc expose svc/https-test -* oc secrets new ks-secret extra-content/standalone/configuration/keystore.jks +* Create a secure route with Termination Type `passthrough` +* oc create secret generic ks-secret --from-file=extra-content/standalone/configuration/keystore.jks * Mount the keystore secret on /etc/wf-secrets in the pod, update DeploymentConfig: spec: volumes: diff --git a/examples/jaxws/README.md b/examples/jaxws/README.md index 91a37268..cfd3f1da 100644 --- a/examples/jaxws/README.md +++ b/examples/jaxws/README.md @@ -7,7 +7,7 @@ Build and run * To build: `mvn package` * To run: `mvn wildfly-jar:run` -* Access the WSDL from any SOAP Client: `http://localhost:8080/jaxws-pojo-endpoint/JSEBean` +* Access the WSDL from any SOAP Client: `http://localhost:8080/jaxws-pojo-endpoint/JSEBean?wsdl` * Send a SOAP Request. Ex.: diff --git a/examples/jib-layers/README.md b/examples/jib-layers/README.md index e00c61cb..a60fe87e 100644 --- a/examples/jib-layers/README.md +++ b/examples/jib-layers/README.md @@ -3,6 +3,8 @@ We are using the packaged JAR and WAR support of Java Image Builder Jib. This example separates the creation of a hollow bootable JAR Jib image from the application JIB image. This allows for efficient application image build. The bootable JAR is built only once. +WARNING: due to https://github.com/GoogleContainerTools/jib/issues/4134 you must use Docker. + * To build the hollow JAR JIB image * cd server-layer diff --git a/examples/jib-operator/README.md b/examples/jib-operator/README.md deleted file mode 100644 index 169215e7..00000000 --- a/examples/jib-operator/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# JAX-RS WildFly bootable jar jib generated image - -We are using the packaged jar support of jib. - -The directory /opt/wildfly is created in order for the WildFly operator to properly manage this image. - -Build and run -============= - -* To build: `mvn package` -* To run: `docker run -p 8080:8080 wildfly/jaxrs-operator-jib` -* Access the application: `http://localhost:8080/hello` - -Deploy and run in OpenShift -======================= - -* Push the image to a docker repository (can update pom.xml to do that directly in jib plugin config). -* oc new-app -* Create a service (selector deploymentconfig: jaxrs-operator-jib, port 8080) -* Expose the service -* Access the application: http://\/hello diff --git a/examples/jib-operator/pom.xml b/examples/jib-operator/pom.xml deleted file mode 100644 index b84375fc..00000000 --- a/examples/jib-operator/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - 4.0.0 - - org.wildfly.plugins - wildfly-jar-examples-parent - 11.0.0.Final-SNAPSHOT - - jaxrs-jib-operator - jar - - WildFly Bootable JAR - JAX-RS with Jib Operator - An example of JAX-RS application with Jib running on the WildFly Operator - - - - jakarta.platform - jakarta.jakartaee-api - provided - - - - - ${project.artifactId} - - - org.apache.maven.plugins - maven-war-plugin - - - package - - war - - - - - - org.wildfly.plugins - wildfly-jar-maven-plugin - - wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly} - - jaxrs-server - observability - - - deployment-scanner - - - ${plugin.fork.embedded} - - - ${project.artifactId}.jar - - - - - package - - - - - - com.google.cloud.tools - jib-maven-plugin - - packaged - - wildfly/jaxrs-operator-jib - - - - - - - - - -b=0.0.0.0 - - - -bmanagement=0.0.0.0 - - - --install-dir=/opt/wildfly - - - - 8080 - - org.wildfly.core.jar.boot.Main - - - - - package - - dockerBuild - - - - - - - - - diff --git a/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/HelloWorldEndpoint.java b/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/HelloWorldEndpoint.java deleted file mode 100644 index c05f6f8b..00000000 --- a/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/HelloWorldEndpoint.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.wildfly.plugins.demo.jiboperator; - - -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; - - -@Path("/hello") -public class HelloWorldEndpoint { - @GET - @Produces("text/plain") - public Response doGet() { - return Response.ok("Hello from WildFly bootable jar!").build(); - } -} diff --git a/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/RestApplication.java b/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/RestApplication.java deleted file mode 100644 index e59bd3a2..00000000 --- a/examples/jib-operator/src/main/java/org/wildfly/plugins/demo/jiboperator/RestApplication.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.wildfly.plugins.demo.jiboperator; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; - -@ApplicationPath("/") -public class RestApplication extends Application { -} diff --git a/examples/jib/README.md b/examples/jib/README.md index 0eba4bf0..ae196e38 100644 --- a/examples/jib/README.md +++ b/examples/jib/README.md @@ -7,8 +7,8 @@ For a decoupling of server packaging and app packaging check ../jib-layers examp Build and run ============= -* To build: `mvn package` -* To run: `docker run -p 8080:8080 wildfly/jaxrs-jib` +* To build: `mvn package` (If using podman add: `-Djib.dockerClient.executable=$(which podman)` +* To run: `docker|podman run -p 8080:8080 wildfly/jaxrs-jib` * Access the application: `http://localhost:8080/hello` Build and run in OpenShift diff --git a/examples/jkube/pom.xml b/examples/jkube/pom.xml index 120587d1..2c79e514 100644 --- a/examples/jkube/pom.xml +++ b/examples/jkube/pom.xml @@ -22,7 +22,7 @@ - registry.redhat.io/ubi8/openjdk-11:latest + registry.redhat.io/ubi8/openjdk-17:latest diff --git a/examples/jsf-ejb-jpa/README.md b/examples/jsf-ejb-jpa/README.md index 89d344c6..16085e8b 100644 --- a/examples/jsf-ejb-jpa/README.md +++ b/examples/jsf-ejb-jpa/README.md @@ -15,17 +15,15 @@ Build and run on OpenShift * mvn package -Popenshift * mkdir os && cp target/jsf-ejb-jpa-bootable.jar os/ -* Import the OpenJDK 11 image to run the Java application, create the image stream and deployment: +* Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: ``` -oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm +oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm -oc new-build --strategy source --binary --image-stream openjdk-11 --name jsf-ejb-jpa-bootable-jar +oc new-build --strategy source --binary --image-stream openjdk-17 --name jsf-ejb-jpa-bootable-jar oc start-build jsf-ejb-jpa-bootable-jar --from-dir ./os/ -oc new-app --name jsf-ejb-jpa-bootable-jar-app \ - --env GC_METASPACE_SIZE=96 \ - jsf-ejb-jpa-bootable-jar +oc new-app --name jsf-ejb-jpa-bootable-jar-app jsf-ejb-jpa-bootable-jar oc expose svc/jsf-ejb-jpa-bootable-jar-app ``` diff --git a/examples/keycloak/README.md b/examples/keycloak/README.md deleted file mode 100644 index 099e93bf..00000000 --- a/examples/keycloak/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# [DEPRECATED] Keycloak WildFly bootable jar example - -WARNING: This example doesn't work with WF 27. Caused by missing JBoss module org.picketbox. - -The example `../elytron-oidc-client` highlight the supported way to secure a deployment using OpenID Connect (OIDC). - -Usage of the Keycloak Galleon feature-pack highlighted in this example is deprecated. - -Build a bootable JAR containing an application secured with Keycloak. -In order to enable keycloak, you must use the Galleon layer `keycloak-client-oidc` that brings in the -OIDC keycloak subsystem. This subsystem is required for WildFly to secure deployments using keycloak. - -In order to declare the deployment to be secured with keycloak, the CLI script `../scripts/configure-oidc.cli` is called during packaging. - -Initial Steps -======= - -* Download the keycloak server from: `https://www.keycloak.org/download` -* Start the keycloak server to listen on port 8090: `keycloak/bin/standalone.sh -Djboss.socket.binding.port-offset=10` -* Log into the keycloak server admin console (you will possibly be asked to create an initial admin user) : `http://127.0.0.1:8090/` -* Create a Realm named `WildFly` -* Create a Role named `Users` -* Create a User named `demo`, password `demo` -* Assign the role `Users` to the user `demo` -* Create a Client named `simple-webapp` with Root URL: `http://127.0.0.1:8080/simple-webapp` - -Build and run -======== - -* To build: `mvn package` -* To run: `mvn wildfly-jar:run` -* Access the application: `http://127.0.0.1:8080/simple-webapp` -* Access the secured servlet. -* Log-in using the `demo` user, `demo` password (that you created in the initial steps). -* You should see a page containing the Principal ID. \ No newline at end of file diff --git a/examples/keycloak/pom.xml b/examples/keycloak/pom.xml deleted file mode 100644 index de5fbdaa..00000000 --- a/examples/keycloak/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - - org.wildfly.plugins - wildfly-jar-examples-parent - 11.0.0.Final-SNAPSHOT - - keycloak - war - - WildFly Bootable JAR - Keycloak - An application secured with Keycloak example - - - - jakarta.platform - jakarta.jakartaee-api - provided - - - - - simple-webapp - - - org.wildfly.plugins - wildfly-jar-maven-plugin - - - - wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly} - - - org.keycloak - keycloak-adapter-galleon-pack - ${version.keycloak} - - - - web-server - keycloak-client-oidc - - false - - - - - - - - - - - - package - - - - - - - - - diff --git a/examples/keycloak/src/main/java/org/wildfly/security/examples/SecuredServlet.java b/examples/keycloak/src/main/java/org/wildfly/security/examples/SecuredServlet.java deleted file mode 100644 index eeb4b6c5..00000000 --- a/examples/keycloak/src/main/java/org/wildfly/security/examples/SecuredServlet.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2017 Red Hat, Inc., and individual contributors - * as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.wildfly.security.examples; - -import java.io.IOException; -import java.io.PrintWriter; -import java.security.Principal; - -import jakarta.servlet.ServletException; -import jakarta.servlet.annotation.HttpMethodConstraint; -import jakarta.servlet.annotation.ServletSecurity; -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -/** - * A simple secured HTTP servlet. - * - * @author Darran Lofthouse - */ -@WebServlet("/secured") -@ServletSecurity(httpMethodConstraints = { @HttpMethodConstraint(value = "GET", rolesAllowed = { "Users" }) }) -public class SecuredServlet extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - try (PrintWriter writer = resp.getWriter()) { - writer.println(""); - writer.println(" Secured Servlet"); - writer.println(" "); - writer.println("

Secured Servlet

"); - writer.println("

"); - writer.print(" Current Principal '"); - Principal user = req.getUserPrincipal(); - writer.print(user != null ? user.getName() : "NO AUTHENTICATED USER"); - writer.print("'"); - writer.println("

"); - writer.println(" "); - writer.println(""); - } - } - -} diff --git a/examples/keycloak/src/main/webapp/WEB-INF/web.xml b/examples/keycloak/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index b184c501..00000000 --- a/examples/keycloak/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - BASIC - Simple Realm - - - diff --git a/examples/keycloak/src/main/webapp/index.html b/examples/keycloak/src/main/webapp/index.html deleted file mode 100644 index 0331adb6..00000000 --- a/examples/keycloak/src/main/webapp/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - -

Hello World!

- Access Secured Servlet - - diff --git a/examples/microprofile-config/README.adoc b/examples/microprofile-config/README.adoc index d3ab57d0..fe95749e 100644 --- a/examples/microprofile-config/README.adoc +++ b/examples/microprofile-config/README.adoc @@ -30,8 +30,8 @@ config3 = Default value for config3 comes from my code $ mvn package -Popenshift $ mkdir target/openshift && cp target/microprofile-config-bootable.jar target/openshift # Import the OpenJDK 11 image to run the Java application -$ oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm -$ oc new-build --strategy source --binary --image-stream openjdk-11 --name microprofile-config-app +$ oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm +$ oc new-build --strategy source --binary --image-stream openjdk-17 --name microprofile-config-app $ oc start-build microprofile-config-app --from-dir target/openshift ---- diff --git a/examples/pom.xml b/examples/pom.xml index 256020ba..5b7da835 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -11,10 +11,9 @@ 11.0.0.Final-SNAPSHOT - 18.0.2 32.0.0.Beta1 8.0.0.Beta1 - 1.0.1 + 1.16.2 true 11 11 @@ -23,8 +22,8 @@ false - 5.0.0.Alpha5 - 1.6.0.Final + 5.0.1.Final + 1.7.0.Final 4.13.1 1.2.6 @@ -92,20 +91,20 @@ ejb-in-war ejb-persistent-clustered-timers elytron-oidc-client - gradle-mdb-rar + hollow-jar https jaxws jaxrs - jib + jsf-ejb-jpa - keycloak logging logging-json - mdb-rar + microprofile-config remote-microprofile-config postgresql diff --git a/examples/postgresql/README.md b/examples/postgresql/README.md index 7c7eb17d..ce1ad306 100644 --- a/examples/postgresql/README.md +++ b/examples/postgresql/README.md @@ -15,11 +15,11 @@ oc new-app --name database-server \ * mvn package -Popenshift * mkdir os && cp target/postgresql-bootable.jar os/ -* Import the OpenJDK 11 image to run the Java application, create the image stream and deployment: +* Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: ``` -oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm +oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm -oc new-build --strategy source --binary --image-stream openjdk-11 --name wf-postgresql +oc new-build --strategy source --binary --image-stream openjdk-17 --name wf-postgresql oc start-build wf-postgresql --from-dir ./os/ @@ -29,7 +29,6 @@ oc new-app --name wf-postgresql-app \ --env POSTGRESQL_SERVICE_HOST=database-server \ --env POSTGRESQL_SERVICE_PORT=5432 \ --env POSTGRESQL_DATABASE=sampledb \ - --env GC_METASPACE_SIZE=96 \ wf-postgresql oc expose svc/wf-postgresql-app diff --git a/examples/remote-microprofile-config/README.adoc b/examples/remote-microprofile-config/README.adoc index db7139be..f65ba350 100644 --- a/examples/remote-microprofile-config/README.adoc +++ b/examples/remote-microprofile-config/README.adoc @@ -45,7 +45,7 @@ Check that the application is running properly : [source,bash] ---- $ curl https://$(oc get route remote-microprofile-config-bootable --template='{{ .spec.host }}') -config1 = Value from Config1 comes from an env var in the DeploymentConfig +config1 = Default value for config1 comes from my code config2 = Value for config2 comes from a properties file inside the application config3 = Default value for config3 comes from my code ---- @@ -59,7 +59,7 @@ For example: [source,bash] ---- $ curl https://$(oc get route remote-microprofile-config-bootable --template='{{ .spec.host }}') -config1 = Value from Config1 comes from an env var in the DeploymentConfig +config1 = Default value for config1 comes from my code config2 = Hello from dev-watch remote config3 = Default value for config3 comes from my code ---- @@ -73,7 +73,7 @@ config3 = Default value for config3 comes from my code [source,docker] ---- -FROM registry.access.redhat.com/ubi8/openjdk-11:latest +FROM registry.access.redhat.com/ubi8/openjdk-17:latest COPY --chown=jboss:root target/*.jar /deployments/. RUN chmod -R ug+rwX /deployments/. ---- @@ -108,7 +108,7 @@ Check that the application is running properly : [source,bash] ---- $ curl http://${container.ip.address}:8080 -config1 = Value from Config1 comes from an env var in the DeploymentConfig +config1 = Default value for config1 comes from my code config2 = Value for config2 comes from a properties file inside the application config3 = Default value for config3 comes from my code ---- @@ -122,7 +122,7 @@ For example: [source,bash] ---- $ curl http://${container.ip.address}:8080 -config1 = Value from Config1 comes from an env var in the DeploymentConfig +config1 = Default value for config1 comes from my code config2 = Hello from dev-watch remote config3 = Default value for config3 comes from my code ---- \ No newline at end of file diff --git a/examples/remote-microprofile-config/src/main/resources/META-INF/microprofile-config.properties b/examples/remote-microprofile-config/src/main/resources/META-INF/microprofile-config.properties index ce2ce2ef..db27feb5 100644 --- a/examples/remote-microprofile-config/src/main/resources/META-INF/microprofile-config.properties +++ b/examples/remote-microprofile-config/src/main/resources/META-INF/microprofile-config.properties @@ -1 +1 @@ -config2=Value for config2 comes from a properties file inside the application +config2=Value for config2 comes from a properties file inside the application XXX diff --git a/examples/scripts/configure-oidc.cli b/examples/scripts/configure-oidc.cli index 05063f8c..431bfa9c 100644 --- a/examples/scripts/configure-oidc.cli +++ b/examples/scripts/configure-oidc.cli @@ -1 +1 @@ -/subsystem=keycloak/secure-deployment=simple-webapp.war:add(realm=WildFly, resource=simple-webapp, public-client=true, auth-server-url=http://localhost:8090/auth/, ssl-required=EXTERNAL) \ No newline at end of file +/subsystem=elytron-oidc-client/secure-deployment=simple-webapp.war:add(realm=WildFly, resource=simple-webapp, public-client=true, auth-server-url=http://localhost:8090/auth/, ssl-required=EXTERNAL) \ No newline at end of file diff --git a/examples/web-clustering-dns-ping/helm.yaml b/examples/web-clustering-dns-ping/helm.yaml index 0d5d75e2..6f774e01 100644 --- a/examples/web-clustering-dns-ping/helm.yaml +++ b/examples/web-clustering-dns-ping/helm.yaml @@ -1,6 +1,6 @@ build: uri: https://github.com/wildfly-extras/wildfly-jar-maven-plugin.git - ref: 7.0.2.Final + ref: 11.0.0.Beta2 contextDir: examples mode: bootable-jar bootableJar: diff --git a/examples/web-clustering/README.md b/examples/web-clustering/README.md index 7a9acca8..9d05ef78 100644 --- a/examples/web-clustering/README.md +++ b/examples/web-clustering/README.md @@ -20,8 +20,8 @@ OpenShift binary build and deployment * mvn package -Popenshift * mkdir os && cp target/web-clustering-bootable.jar os/ * oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -* oc import-image ubi8/openjdk-11 --from=registry.redhat.io/ubi8/openjdk-11 --confirm -* oc new-build --strategy source --binary --image-stream openjdk-11 --name web-clustering +* oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm +* oc new-build --strategy source --binary --image-stream openjdk-17 --name web-clustering * oc start-build web-clustering --from-dir ./os/ * oc new-app web-clustering -e KUBERNETES_NAMESPACE=$(oc project -q) -e JGROUPS_CLUSTER_PASSWORD=mypassword * KUBERNETES_NAMESPACE env variable is required to see other pods in the project, otherwise the server attempts to retrieve pods from the 'default' namespace that is not the one our project is using. diff --git a/pom.xml b/pom.xml index cd3da792..2b167d3e 100644 --- a/pom.xml +++ b/pom.xml @@ -64,11 +64,11 @@ 3.7.0 3.7.0 2.0.0 - 6.0.0.Beta6 + 6.0.0.Final 24.0.0.Beta3 1.6.0.Final - 5.0.0.Beta4 - 1.0.0.Beta3 + 5.0.0.Beta5 + 1.0.0.Final 1.1.0.Final 1.2.1.Final 3.0.0-M6 diff --git a/release_process.adoc b/release_process.adoc index 1a20ec6a..b08e48ea 100644 --- a/release_process.adoc +++ b/release_process.adoc @@ -7,9 +7,7 @@ First, make sure you don't have pending changes in your main branch. * `cd wildfly-jar-maven-plugin` * `git checkout main` * `git pull --rebase upstream main` -* Validate that all examples build: `cd examples, mvn clean package`. NB: exclude temporarily mdb-rar and -gradle-demo that doesn't build but we want them in the parent pom file to update their pom version. -* Build grade-demo using gradle. Build mdb-rar in the mdb-rar directory. +* Update examples/**/helm.yaml with the released tag. * Update in pom.xml docs.project.branch to reference the new release * Update in pom.xml docs.wildfly.major to reference the WildFly major release (if a new WildFly final release on which the plugin depends has been released). * Update the examples/pom.xml file to reference the released plugin @@ -17,6 +15,7 @@ gradle-demo that doesn't build but we want them in the parent pom file to update ** cd examples ** mvn versions:set -DnewVersion= ** mvn versions:commit +** Do the same in the directory: gradle-mdb-rar, jib*, jkube and mdb-rar ** cd .. * Commit the changes with message: `Update docs and examples to X.X.X.Final` * Run tests: `mvn clean install -Dskip.perf.tests=false` diff --git a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/AbstractBootableJarMojoTestCase.java b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/AbstractBootableJarMojoTestCase.java index a3ad004b..4c04b433 100644 --- a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/AbstractBootableJarMojoTestCase.java +++ b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/AbstractBootableJarMojoTestCase.java @@ -27,7 +27,6 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; @@ -392,15 +391,16 @@ protected String getContent(String url) throws Exception { } protected Process startServer(Path dir, String fileName, String... args) throws Exception { + final List serverArgs = List.of(args); List cmd = new ArrayList<>(); cmd.add(getJavaCommand()); - cmd.addAll(getJvmArgs()); + cmd.addAll(getJvmArgs(serverArgs.contains("-secmgr"))); // On windows, to remove when Upgraded to WILDFLY 26.1.1 that should contain XNIO 3.8.7 // https://issues.redhat.com/browse/XNIO-404 cmd.add("-Djdk.io.File.enableADS=true"); cmd.add("-jar"); cmd.add(dir.resolve("target").resolve(fileName == null ? TEST_FILE : fileName).toAbsolutePath().toString()); - cmd.addAll(Arrays.asList(args)); + cmd.addAll(serverArgs); final Path out = TestEnvironment.createTempPath("logs", getClass().getName() + "-process.txt"); final Path parent = out.getParent(); if (parent != null && Files.notExists(parent)) { @@ -515,7 +515,7 @@ private static String getJavaCommand() { return cmd; } - private static Collection getJvmArgs() { + private static Collection getJvmArgs(final boolean securityManager) { final Collection result = new ArrayList<>(); final String defaultArgs = System.getProperty("test.jvm.args"); if (defaultArgs != null) { @@ -526,6 +526,9 @@ private static Collection getJvmArgs() { } } } + if (securityManager && TestEnvironment.javaVersion() >= 17) { + result.add("-Djava.security.manager=allow"); + } return result; } diff --git a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/TestEnvironment.java b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/TestEnvironment.java index 216b683b..3d07a2c7 100644 --- a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/TestEnvironment.java +++ b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/TestEnvironment.java @@ -33,10 +33,12 @@ class TestEnvironment { private static final int MGMT_PORT = getProperty("ts.mgmt.port", 9990); private static final String TMP_DIR = System.getProperty("java.io.tmpdir", "target"); private static final boolean IS_WINDOWS; + private static final int JAVA_VERSION; static { final String os = System.getProperty("os.name").toLowerCase(Locale.ROOT); IS_WINDOWS = os.contains("win"); + JAVA_VERSION = Integer.parseInt(System.getProperty("java.vm.specification.version")); } /** @@ -107,6 +109,15 @@ static Path createTempPath(final String... paths) { return Paths.get(TMP_DIR, paths); } + /** + * Returns the current Java version. + * + * @return the java version + */ + static int javaVersion() { + return JAVA_VERSION; + } + private static int getProperty(final String name, final int dft) { final String value = System.getProperty(name); return value == null ? dft : Integer.parseInt(value); diff --git a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactEE9TransformTestCase.java b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactEE9TransformTestCase.java index f2e95d37..54a4e58e 100644 --- a/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactEE9TransformTestCase.java +++ b/tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactEE9TransformTestCase.java @@ -37,6 +37,7 @@ public UpgradeArtifactEE9TransformTestCase() { @Test public void testUpgrade() throws Exception { Assume.assumeFalse("Not stupported on XP", isXP()); + Assume.assumeFalse("Not supprted on JDK11", TestEnvironment.javaVersion() < 17); BuildBootableJarMojo mojo = lookupMojo("package"); MavenProjectArtifactVersions artifacts = MavenProjectArtifactVersions.getInstance(mojo.project); Assert.assertEquals(2, mojo.overriddenServerArtifacts.size());