1.4. pom.xml ファイルを設定して Red Hat build of Quarkus プロジェクトを作成する
Maven の pom.xml ファイルを設定することで、既存の Maven プロジェクトを使用して Quarkus プロジェクトを作成できます。
手順
-
テキストエディターで
pom.xmlファイルを開きます。 次の項目を含む設定プロパティーを追加します。
- Maven Compiler プラグインのバージョン
-
Quarkus BOM の
groupID、artifactID、およびversion - Maven Surefire プラグインのバージョン
-
skipITsプロパティー
<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.15.7.redhat-00001</quarkus.platform.version> <surefire-plugin.version>3.1.2</surefire-plugin.version> <skipITs>true</skipITs> </properties>Quarkus GAV (グループ、アーティファクト、バージョン) を追加し、
quarkus-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 プラグイン、Maven Compiler プラグイン、Maven Surefire プラグインを追加します。
<build> <plugins> <plugin> <groupId>${quarkus.platform.group-id}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${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>${compiler-plugin.version}</version> <configuration> <compilerArgs> <arg>-parameters</arg> </compilerArgs> </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>${surefire-plugin.version}</version> <configuration> <systemPropertyVariables> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${maven.home}</maven.home> </systemPropertyVariables> </configuration> </plugin> </plugins> </build>注記maven-surefire-pluginは、アプリケーションのユニットテストを実行します。オプション: ネイティブアプリケーションをビルドするには、
maven-failsafe-pluginを含むネイティブプロファイルを追加します。<build> <plugins> ... <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>${surefire-plugin.version}</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> <configuration> <systemPropertyVariables> <native.image.path>${project.build.directory}/${project.build.finalName}-runner </native.image.path> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <maven.home>${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>-
名前に
ITが含まれ、@QuarkusIntegrationTestアノテーションを含むテストは、ネイティブ実行可能ファイルに対して実行します。 - ネイティブモードと Java 仮想マシン (JVM) モードの違いの詳細は、「Red Hat build of Quarkus の使用開始」ガイドの JVM およびネイティブビルドモード を参照してください。
-
名前に