2.2. CLI の実行
アプリケーションに対して MTA を実行できます。
手順
-
ターミナルを開き、
<MTA_HOME>/ディレクトリーに移動します。 mta-cliスクリプト (Windows の場合はmta-cli.exe) を実行し、適切な引数を指定します。$ ./mta-cli analyze --input /path/to/jee-example-app-1.0.0.ear \ --output /path/to/output --source weblogic --target eap6 \-
--input: 評価されるアプリケーション。 -
--output: 生成されたレポートの出力ディレクトリー。 -
--source: アプリケーション移行元のテクノロジー。
-
- レポートにアクセスします。
2.2.1. MTA コマンドの例 リンクのコピーリンクがクリップボードにコピーされました!
アプリケーションアーカイブでの MTA の実行
以下のコマンドは、JBoss EAP 5 から JBoss EAP 7 に移行するための jee-example-app-1.0.0.ear サンプル EAR アーカイブを分析します。
$ <MTA_HOME>/mta-cli analyze \
--input /path/to/jee-example-app-1.0.0.ear \
--output /path/to/report-output/ --source eap5 --target eap7 \
ソースコードでの MTA の実行
以下のコマンドは、JBoss EAP 6 に移行するための seam-booking-5.2 サンプルソースコードを分析します。
$ <MTA_HOME>/mta-cli analyze --mode source-only --input /path/to/seam-booking-5.2/ \
--output /path/to/report-output/ --target eap6 --packages org.jboss.seam
cloud-readiness ルールの実行
以下のコマンドは、JBoss EAP 7 に移行するための jee-example-app-1.0.0.ear サンプル EAR アーカイブを分析します。また、クラウドの準備ができるかどうかも評価します。
$ <MTA_HOME>/mta-cli analyze --input /path/to/jee-example-app-1.0.0.ear \
--output /path/to/report-output/ \
--target eap7
2.2.2. コマンドラインを使用して分析を実行する リンクのコピーリンクがクリップボードにコピーされました!
Analyze では、analyzer-lsp を使用してソースコードとバイナリー分析を実行できます。
アプリケーションのソースコード分析を実行するには、次のコマンドを実行します。
mta-cli analyze --input=<path/to/source/code> --output=<path/to/output/dir>
すべてのフラグ:
Analyze application source code
Usage:
mta-cli analyze [flags]
Flags:
--analyze-known-libraries analyze known open-source libraries
-h, --help help for analyze
-i, --input string path to application source code or a binary
--json-output create analysis and dependency output as json
--list-sources list rules for available migration sources
--list-targets list rules for available migration targets
-l, --label-selector string run rules based on specified label selector expression
--maven-settings string path to a custom maven settings file to use
--overwrite overwrite output directory
--skip-static-report do not generate the static report
-m, --mode string analysis mode. Must be one of 'full' or 'source-only' (default "full")
-o, --output string path to the directory for analysis output
--rules stringArray filename or directory containing rule files
--skip-static-report do not generate the static report
-s, --source string source technology to consider for analysis. To specify multiple sources, repeat the parameter: --source <source_1> --source <source_2> etc.
-t, --target string target technology to consider for analysis. To specify multiple targets, repeat the parameter: --target <target_1> --target <target_2> etc.
Global Flags:
--log-level uint32 log level (default 4)
--no-cleanup do not cleanup temporary resources
使用例:
- 分析を実行するサンプルアプリケーションを取得します。
利用可能なターゲットテクノロジーをリストします。
mta-cli analyze --list-targets指定したターゲットテクノロジー (例:
cloud-readiness) を使用して分析を実行します。mta-cli analyze --input=<path-to/example-applications/example-1> --output=<path-to-output-dir> --target=cloud-readiness指定した出力パスに、いくつかの分析レポートが作成されます。
$ ls ./output/ -1 analysis.log dependencies.yaml dependency.log output.yaml static-report
output.yaml は、Issues レポートが含まれるファイルです。
static-report には、静的 HTML レポートが含まれます。
dependencies.yaml には、依存関係レポートが含まれます。
2.2.3. コマンドラインを使用して変換を実行する リンクのコピーリンクがクリップボードにコピーされました!
Transform には、openrewrite と rules という 2 つのサブコマンドがあります。
Transform application source code or mta XML rules
Usage:
mta-cli transform [flags]
mta-cli transform [command]
Available Commands:
openrewrite Transform application source code using OpenRewrite recipes
rules Convert XML rules to YAML
Flags:
-h, --help help for transform
Global Flags:
--log-level uint32 log level (default 4)
--no-cleanup do not cleanup temporary resources
Use "mta-cli transform [command] --help" for more information about a command.
2.2.3.1. OpenRewrite リンクのコピーリンクがクリップボードにコピーされました!
openrewrite サブコマンドを使用すると、ソースコードで OpenRewrite レシピを実行できます。
Transform application source code using OpenRewrite recipes
Usage:
mta-cli transform openrewrite [flags]
Flags:
-g, --goal string target goal (default "dryRun")
-h, --help help for openrewrite
-i, --input string path to application source code directory
-l, --list-targets list all available OpenRewrite recipes
-s, --maven-settings string path to a custom maven settings file to use
-t, --target string target openrewrite recipe to use. Run --list-targets to get a list of packaged recipes.
Global Flags:
--log-level uint32 log level (default 4)
--no-cleanup do not cleanup temporary resources
アプリケーションのソースコードで transform openrewrite を実行するには、次のコマンドを実行します。
mta-cli transform openrewrite --input=<path/to/source/code> --target=<exactly_one_target_from_the_list>
transform overwrite コマンドの実行に使用できるターゲットは 1 つだけです。
2.2.3.2. Rules リンクのコピーリンクがクリップボードにコピーされました!
rules サブコマンドを使用すると、windup-shim を使用して mta XML ルールを analyzer-lsp YAML ルールに変換できます。
Convert XML rules to YAML
Usage:
mta-cli transform rules [flags]
Flags:
-h, --help help for rules
-i, --input stringArray path to XML rule file(s) or directory
-o, --output string path to output directory
Global Flags:
--log-level int log level (default 5)
アプリケーションのソースコードで transform rules を実行するには、以下を実行します。
mta-cli transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir>
使用例:
- ソースコードを変換するサンプルアプリケーションを取得します。
利用可能な OpenRewrite レシピを表示します。
mta-cli transform openrewrite --list-targetsサンプルアプリケーションでレシピを実行します。
mta-cli transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-importsjakartaee-dukeアプリケーションのソースコードの差分を調べて、変換を確認します。
2.2.3.3. 利用可能な OpenRewrite レシピ リンクのコピーリンクがクリップボードにコピーされました!
| 移行パス | 目的 | rewrite.configLocation | activeRecipes |
|---|---|---|---|
| Java EE から Jakarta EE |
|
|
|
| Java EE から Jakarta EE | ブートストラップファイルの名前を変更する |
|
|
| Java EE から Jakarta EE |
|
|
|
| Spring Boot から Quarkus |
|
|
|