第4章 pom.xml ファイルの設定による Quarkus プロジェクトの作成
Maven POM XML ファイルを設定して Quarkus プロジェクトを作成できます。
手順
-
テキストエディターで
pom.xml
ファイルを開きます。 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-plugin.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-plugin.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
アノテーションが付けられ、ネイティブ実行可能ファイルに対して実行されます。