6.2. Dekorate を使用するようにアプリケーションプロジェクトを設定します。
Dekorate BOM および OpenShift Annotations Starter をアプリケーションプロジェクトの pom.xml
ファイルに追加します。基本的なアノテーションをソースファイルに追加し、Maven でアプリケーションをパッケージ化してアプリケーションマニフェストを生成します。
前提条件
- Spring Bootを使用するよう設定された Maven ベースのアプリケーションプロジェクト
- Spring Boot を使用する Java ベースのアプリケーション
- Java JDK 8 または JDK 11 がインストールされている。
- Maven がインストールされている。
手順
OpenShift アノテーション Starter をアプリケーションの
pom.xml
ファイルに追加します。<project> ... <dependencies> ... <dependency> <groupId>io.dekorate</groupId> <artifactId>openshift-annotations</artifactId> </dependency> <dependency> <groupId>io.dekorate</groupId> <artifactId>openshift-spring-starter</artifactId> </dependency> ... </dependencies> ... <project>
@Dekorate
アノテーションをアプリケーションプロジェクトのソースファイルに追加します。package org.acme; import io.dekorate.annotation.Dekorate; @Dekorate public class Application { }
アプリケーションをパッケージ化します。
mvn clean package
-
生成されたアプリケーションテンプレートファイルを含む
target/classes/META-INF/dekorate
ディレクトリーに移動します。