第4章 pom.xml ファイルの設定による Quarkus プロジェクトの作成
Maven POM XML ファイルを設定して Quarkus プロジェクトを作成できます。
手順
-
テキストエディターで
pom.xmlファイルを開きます。 以下が含まれる設定プロパティーを追加します。
- Quarkus Maven プラグインのバージョン
-
Quarkus BOM の
groupID、artifactID、およびversion - Maven Surefire プラグインのバージョン
<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>Quarkus GAV (Group、Artifact、Version) を追加し、
quarkus-universe-bomファイルを使用して、Quarkus の異なる依存関係のバージョンを省略します。<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>Quarkus Maven プラグインを追加します。
<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>任意手順: ネイティブアプリケーションをビルドするには、Maven Surefire および Maven Failsafe プラグインを含む特定のネイティブプロファイルを追加し、
nativeパッケージタイプを有効にします。<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>名前に
ITが含まれるテストは、@NativeImageTestアノテーションが付けられ、ネイティブ実行可能ファイルに対して実行されます。