Developing and compiling your Red Hat build of Quarkus applications with Apache Maven Red Hat build of Quarkus 3.8 Red Hat Customer Content Services

Commands:
<!-- Configure the Red Hat build of Quarkus Maven repository --> <profile> <id>red-hat-enterprise-maven-repository</id> <repositories> <repository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
<activeProfile>red-hat-enterprise-maven-repository</activeProfile>
mvn --version
mvn com.redhat.quarkus.platform:quarkus-maven-plugin:3.8.6.SP3-redhat-00002:create -DprojectGroupId=<project_group_id> -DprojectArtifactId=<project_artifact_id> -DplatformGroupId=com.redhat.quarkus.platform -DplatformArtifactId=quarkus-bom -DplatformVersion=3.8.6.SP3-redhat-00002 -DpackageName=getting.started
mvn com.redhat.quarkus.platform:quarkus-maven-plugin:3.8.6.SP3-redhat-00002:create
quarkus create app my-groupId:my-artifactId --package-name=getting.started
quarkus create app --help
<properties> <compiler-plugin.version>3.11.0</compiler-plugin.version> <quarkus.platform.group-id>com.redhat.quarkus.platform</quarkus.platform.group-id> <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> <quarkus.platform.version>3.8.6.SP3-redhat-00002</quarkus.platform.version> <surefire-plugin.version>3.1.2</surefire-plugin.version> <skipITs>true</skipITs> </properties>
<dependencyManagement> <dependencies> <dependency> <groupId>USD{quarkus.platform.group-id}</groupId> <artifactId>USD{quarkus.platform.artifact-id}</artifactId> <version>USD{quarkus.platform.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
<build> <plugins> <plugin> <groupId>USD{quarkus.platform.group-id}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>USD{quarkus.platform.version}</version> <extensions>true</extensions> <executions> <execution> <goals> <goal>build</goal> <goal>generate-code</goal> <goal>generate-code-tests</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>USD{compiler-plugin.version}</version> <configuration> <compilerArgs> <arg>-parameters</arg> </compilerArgs> </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>USD{surefire-plugin.version}</version> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>USD{maven.home}</maven.home> </systemPropertyVariables> </configuration> </plugin> </plugins> </build>
<build> <plugins> <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>USD{surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <native.image.path>USD{project.build.directory}/USD{project.build.finalName}-runner </native.image.path> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>USD{maven.home}</maven.home> </systemPropertyVariables> </configuration> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>native</id> <activation> <property> <name>native</name> </property> </activation> <properties> <skipITs>false</skipITs> <quarkus.package.type>native</quarkus.package.type> </properties> </profile> </profiles>
cd <directory_name>
./mvnw quarkus:dev
quarkus dev
<plugin> <groupId>com.redhat.quarkus.platform</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>USD{quarkus.platform.version}</version> <configuration> <source>USD{maven.compiler.source}</source> <target>USD{maven.compiler.target}</target> <compilerArgs> <arg>-verbose</arg> </compilerArgs> <jvmArgs>-verbose</jvmArgs> </configuration> </plugin>
./mvnw quarkus:list-extensions
quarkus extension --installable
./mvnw quarkus:add-extension -Dextensions="<extension>"
./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-agroal"
quarkus extension add '<extension>'
./mvnw quarkus:add-extension -Dextensions=agroal
[SUCCESS] ✅ Extension io.quarkus:quarkus-agroal has been installed
quarkus extension add 'agroal'
./mvnw quarkus:dev
quarkus dev
./mvnw quarkus:dev
quarkus dev
./mvnw quarkus:dev
quarkus dev
message=Hello %test.message=Test Value
mvn test -Dquarkus.test.profile=__<profile-name>__
./mvnw quarkus:dependency-tree
[INFO] └─ io.quarkus:quarkus-resteasy-deployment:jar:3.8.6.SP3-redhat-00002 (compile) [INFO] ├─ io.quarkus:quarkus-resteasy-server-common-deployment:jar:3.8.6.SP3-redhat-00002 (compile) [INFO] │ ├─ io.quarkus:quarkus-resteasy-common-deployment:jar:3.8.6.SP3-redhat-00002 (compile) [INFO] │ │ ├─ io.quarkus:quarkus-resteasy-common:jar:3.8.6.SP3-redhat-00002 (compile) [INFO] │ │ │ ├─ org.jboss.resteasy:resteasy-core:jar:6.2.4.Final-redhat-00003 (compile) [INFO] │ │ │ │ ├─ jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.0.redhat-00008 (compile) [INFO] │ │ │ │ ├─ org.jboss.resteasy:resteasy-core-spi:jar:6.2.4.Final-redhat-00003 (compile) [INFO] │ │ │ │ ├─ org.reactivestreams:reactive-streams:jar:1.0.4.redhat-00003 (compile) [INFO] │ │ │ │ └─ com.ibm.async:asyncutil:jar:0.1.0.redhat-00010 (compile)
<profiles> <profile> <id>native</id> <activation> <property> <name>native</name> </property> </activation> <properties> <skipITs>false</skipITs> <quarkus.package.type>native</quarkus.package.type> </properties> </profile> </profiles>
./mvnw package -Dnative -Dquarkus.native.container-build=true
./mvnw package -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman
quarkus build --native -Dquarkus.native.container-build=true
quarkus build --native -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman
./target/*-runner
./mvnw package -Dnative
quarkus build --native
./target/*-runner
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 WORKDIR /work/ RUN chown 1001 /work && chmod "g+rwX" /work && chown 1001:root /work COPY --chown=1001:root target/*-runner /work/application EXPOSE 8080 USER 1001 ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
registry.access.redhat.com/ubi8/ubi:8.9
registry.access.redhat.com/ubi8/ubi-minimal:8.9
./mvnw package -Dnative -Dquarkus.native.container-build=true
./mvnw package -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman
docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started
build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started
docker run -i --rm -p 8080:8080 quarkus-quickstart/getting-started
run -i --rm -p 8080:8080 quarkus-quickstart/getting-started
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>USD{surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <native.image.path>USD{project.build.directory}/USD{project.build.finalName}-runner</native.image.path> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>USD{maven.home}</maven.home> </systemPropertyVariables> </configuration> </execution> </executions> </plugin>
package org.acme; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest 1 public class GreetingResourceIT extends GreetingResourceTest { 2 // Execute the same tests but in native mode. }
./mvnw verify -Dnative
./mvnw verify -Dnative . GraalVM Native Image: Generating 'getting-started-1.0.0-SNAPSHOT-runner' (executable) ======================================================================================================================== [1/8] Initializing... (6.6s @ 0.22GB) Java version: 17.0.7+7, vendor version: Mandrel-23.1.0.0-Final Graal compiler: optimization level: 2, target machine: x86-64-v3 C compiler: gcc (redhat, x86_64, 13.2.1) Garbage collector: Serial GC (max heap size: 80% of RAM) 2 user-specific feature(s) - io.quarkus.runner.Feature: Auto-generated class by Red&#160;Hat build of Quarkus from the existing extensions - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase [2/8] Performing analysis... [******] (40.0s @ 2.05GB) 10,318 (86.40%) of 11,942 types reachable 15,064 (57.36%) of 26,260 fields reachable 52,128 (55.75%) of 93,501 methods reachable 3,298 types, 109 fields, and 2,698 methods registered for reflection 63 types, 68 fields, and 55 methods registered for JNI access 4 native libraries: dl, pthread, rt, z [3/8] Building universe... (5.9s @ 1.31GB) [4/8] Parsing methods... [**] (3.7s @ 2.08GB) [5/8] Inlining methods... [***] (2.0s @ 1.92GB) [6/8] Compiling methods... [******] (34.4s @ 3.25GB) [7/8] Layouting methods... [[7/8] Layouting methods... [**] (4.1s @ 1.78GB) [8/8] Creating image... [**] (4.5s @ 2.31GB) 20.93MB (48.43%) for code area: 33,233 compilation units 21.95MB (50.80%) for image heap: 285,664 objects and 8 resources 337.06kB ( 0.76%) for other data 43.20MB in total . [INFO] [INFO] --- maven-failsafe-plugin:3.0.0-M7:integration-test (default) @ getting-started --- [INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.acme.GreetingResourceIT __ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ --\___\_\____/_/ |_/_/|_/_/|_|\____/___/ 2024-06-27 14:04:52,681 INFO [io.quarkus] (main) getting-started 1.0.0-SNAPSHOT native (powered by Quarkus 3.8.6.SP3-redhat-00002) started in 0.038s. Listening on: http://0.0.0.0:8081 2024-06-27 14:04:52,682 INFO [io.quarkus] (main) Profile prod activated. 2024-06-27 14:04:52,682 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx] [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.696 s - in org.acme.GreetingResourceIT [INFO] [INFO] Results: [INFO] [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] --- maven-failsafe-plugin:3.0.0-M7:verify (default) @ getting-started ---
./mvnw verify -Dnative -Dquarkus.test.wait-time= <duration>
./mvnw quarkus:dev
quarkus dev
./mvnw quarkus:dev -Dsuspend
./mvnw quarkus:dev -Ddebug=false
./mvnw quarkus:dev -Dsuspend
quarkus dev --suspend
./mvnw quarkus:dev -DdebugHost=<host-ip-address>
quarkus dev --debug-host=<host-ip-address>
0.0.0.0