Chapter 4. Creating a Quarkus project by configuring the pom.xml file
You can create a Quarkus project by configuring the Maven POM XML file.
Procedure
-
Open the
pom.xmlfile in a text editor. Add the configuration properties that contain:
- the version of the Quarkus Maven plugin
-
the
groupID,artifactIDandversionof the Quarkus BOM - the version of the Maven Surefire plugin
<properties> <quarkus-plugin.version>1.11.7.Final-redhat-00009</quarkus-plugin.version> <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id> <quarkus.platform.group-id>com.redhat.quarkus</quarkus.platform.group-id> <quarkus.platform.version>1.11.7.Final-redhat-00009</quarkus.platform.version> <surefire-plugin.version>3.0.0-M5</surefire-plugin.version> </properties>Add the Quarkus GAV (group, artifact, version) and use the
quarkus-universe-bomfile to omit the versions of the different Quarkus dependencies:<dependencyManagement> <dependencies> <dependency> <groupId>${quarkus.platform.group-id}</groupId> <artifactId>${quarkus.platform.artifact-id}</artifactId> <version>${quarkus.platform.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>Add the Quarkus Maven plug-in:
<build> <plugins> <plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus.platform.version}</version> <executions> <execution> <goals> <goal>build</goal> </goals> </execution> </executions> </plugin> </plugins> </build>Optional: To build a native application, add a specific native profile that includes the Maven Surefire and Maven Failsafe plug-ins and enable the
nativepackage type:<profiles> <profile> <id>native</id> <properties> <quarkus.package.type>native</quarkus.package.type> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemProperties> <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> </systemProperties> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>Tests that include
ITin their names are annotated@NativeImageTestare run against the native executable.