2.2. Spring Boot BOM を使用した依存関係バージョンの管理
製品 BOM を使用して、アプリケーションプロジェクトで Spring Boot 製品依存関係のバージョンを管理します。
手順
dev.snowdrop:snowdrop-dependencies
アーティファクトをプロジェクトのpom.xml
の<dependencyManagement>
セクションに追加し、<type>
属性値および<scope>
属性値を指定します。<project> ... <dependencyManagement> <dependencies> <dependency> <groupId>dev.snowdrop</groupId> <artifactId>snowdrop-dependencies</artifactId> <version>2.2.11.SP1-redhat-00001</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
以下のプロパティーを追加して、使用している Spring Boot Maven プラグインのバージョンを追跡します。
<project> ... <properties> <spring-boot-maven-plugin.version>2.2.11.RELEASE</spring-boot-maven-plugin.version> </properties> ... </project>
BOM およびサポートされる Spring Boot Starters および Spring Boot Maven プラグインを含むリポジトリーの名前と URL を指定します。
<!-- Specify the repositories containing Spring Boot artifacts. --> <repositories> <repository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </repository> </repositories> <!-- Specify the repositories containing the plugins used to execute the build of your application. --> <pluginRepositories> <pluginRepository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </pluginRepository> </pluginRepositories>
spring-boot-maven-plugin
を Maven がアプリケーションのパッケージ化に使用するプラグインとして追加します。<project> ... <build> ... <plugins> ... <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot-maven-plugin.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <redeploy>true</redeploy> </configuration> </plugin> ... </plugins> ... </build> ... </project>