2.2. CLI の実行


アプリケーションに対して MTA を実行できます。

手順

  1. ターミナルを開き、<MTA_HOME>/ ディレクトリーに移動します。
  2. 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 \
    Copy to Clipboard Toggle word wrap
    • --input: 評価されるアプリケーション。
    • --output: 生成されたレポートの出力ディレクトリー。
    • --source: アプリケーション移行元のテクノロジー。
  3. レポートにアクセスします。

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 \
Copy to Clipboard Toggle word wrap
ソースコードでの 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
Copy to Clipboard Toggle word wrap
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
Copy to Clipboard Toggle word wrap

2.2.2. コマンドラインを使用して分析を実行する

Analyze では、analyzer-lsp を使用してソースコードとバイナリー分析を実行できます。

アプリケーションのソースコード分析を実行するには、次のコマンドを実行します。

mta-cli analyze --input=<path/to/source/code> --output=<path/to/output/dir>
Copy to Clipboard Toggle word wrap

すべてのフラグ:

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
Copy to Clipboard Toggle word wrap

使用例:

  1. 分析を実行するサンプルアプリケーションを取得します。
  2. 利用可能なターゲットテクノロジーをリストします。

    mta-cli analyze --list-targets
    Copy to Clipboard Toggle word wrap
  3. 指定したターゲットテクノロジー (例: cloud-readiness) を使用して分析を実行します。

    mta-cli analyze --input=<path-to/example-applications/example-1> --output=<path-to-output-dir> --target=cloud-readiness
    Copy to Clipboard Toggle word wrap
  4. 指定した出力パスに、いくつかの分析レポートが作成されます。

    $ ls ./output/ -1
    analysis.log
    dependencies.yaml
    dependency.log
    output.yaml
    static-report
    Copy to Clipboard Toggle word wrap

output.yaml は、Issues レポートが含まれるファイルです。

static-report には、静的 HTML レポートが含まれます。

dependencies.yaml には、依存関係レポートが含まれます。

2.2.3. コマンドラインを使用して変換を実行する

Transform には、openrewriterules という 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.
Copy to Clipboard Toggle word wrap

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
Copy to Clipboard Toggle word wrap

アプリケーションのソースコードで transform openrewrite を実行するには、次のコマンドを実行します。

mta-cli transform openrewrite --input=<path/to/source/code> --target=<exactly_one_target_from_the_list>
Copy to Clipboard Toggle word wrap

注記

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)
Copy to Clipboard Toggle word wrap

アプリケーションのソースコードで transform rules を実行するには、以下を実行します。

mta-cli transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir>
Copy to Clipboard Toggle word wrap

使用例:

  1. ソースコードを変換するサンプルアプリケーションを取得します。
  2. 利用可能な OpenRewrite レシピを表示します。

    mta-cli transform openrewrite --list-targets
    Copy to Clipboard Toggle word wrap
  3. サンプルアプリケーションでレシピを実行します。

    mta-cli transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-imports
    Copy to Clipboard Toggle word wrap

    jakartaee-duke アプリケーションのソースコードの差分を調べて、変換を確認します。

2.2.3.3. 利用可能な OpenRewrite レシピ

Expand
表2.1 利用可能な OpenRewrite レシピ
移行パス目的rewrite.configLocationactiveRecipes

Java EE から Jakarta EE

javax パッケージのインポートを同等の jakarta パッケージに置き換える

pom.xml ファイル内で宣言された javax アーティファクトを jakarta と同等のものに置き換える

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/imports/rewrite.yml

org.jboss.windup.JavaxToJakarta

Java EE から Jakarta EE

ブートストラップファイルの名前を変更する

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/bootstrapping/rewrite.yml

org.jboss.windup.jakarta.javax. \ BootstrappingFiles

Java EE から Jakarta EE

persistence.xml 設定を変換する

<MTA_HOME>/rules/openrewrite/jakarta \ /javax/xml/rewrite.yml

org.jboss.windup.javax-jakarta. \ PersistenceXML

Spring Boot から Quarkus

application*.properties に一致するファイル内の spring.jpa.hibernate.ddl-auto プロパティーを置き換える

<MTA_HOME>/rules/openrewrite/quarkus \ /springboot/properties/rewrite.yml

org.jboss.windup.sb-quarkus.Properties

トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat