Este contenido no está disponible en el idioma seleccionado.

Chapter 2. Installing and Running the CLI


2.1. Installing the CLI

You can install the CLI on Linux, Windows, or macOS operating systems using the downloadable .zip file.

Important

Starting from MTA 7.2.0, you can run the application analysis for Java applications in the containerless mode.

The containerless mode is set by default and is used automatically if all requirements are met. For more information, see Running the containerless CLI.

However, if you want to analyze applications in languages other than Java or, for example, use transformation commands, you still need to use containers.

Prerequisites for containerized CLI

The following are the prerequisites for the Migration Toolkit for Applications (MTA) CLI installation (container):

  • Red Hat Container Registry Authentication for registry.redhat.io. Red Hat distributes container images from registry.redhat.io, which requires authentication. For more details, see Red Hat Container Registry Authentication.
  • Podman must be installed.
  • 8 GB of RAM is required for the MTA CLI.

Prerequisites for containerless CLI

The following are the prerequisites if you want to to run MTA CLI as in containerless CLI mode:

  • Java Development Kit (JDK) is installed.

    MTA supports the following JDKs:

    • Oracle JDK 17 or later
    • Eclipse Temurin™ JDK 17 or later
    • OpenJDK 17 or later

      If you install OpenJDK on Red Hat Enterprise Linux (RHEL) or Fedora, the JDK requires a compiler provided by the devel package to also be installed, as having only the Java Runtime (JRE) installed causes issues during analysis. For more information about installing Red Hat build of OpenJDK 17 on Red Hat Enterprise Linux (RHEL), see Installing Red Hat build of OpenJDK on RHEL by using yum.

  • You must set the JAVA_HOME and the PATH environment variables.
  • Maven 3.9.9 installed, and the bin directory is added to the PATH environment variable. Setting the path and environment variables depends on the operating system you are using. For more information about installing Maven, see Apache Maven installation.
  • macOS installation requires:

    • The value of maxproc must be 2048 or greater.

2.1.1. Installing the CLI .zip file

Procedure

  1. Navigate to the MTA Download page and download the OS-specific CLI file or the src file:

    • mta-7.2.3-cli-linux-amd64.zip
    • mta-7.2.3-cli-linux-arm64.zip
    • mta-7.2.3-cli-darwin-amd64.zip
    • mta-7.2.3-cli-darwin-arm64.zip
    • mta-7.2.3-cli-windows-amd64.zip
    • mta-7.2.3-cli-windows-arm64.zip
    • mta-7.2.3-cli-src.zip
  2. Extract the .zip file to the .kantra directory inside your $HOME directory. The .zip file extracts the mta-cli binary, along with other required directories and files.

    When you encounter <MTA_HOME> in this guide, replace it with the actual path to your MTA installation.

2.1.2. Installing the CLI by using Podman

You can install the containerized CLI using podman pull.

Note

You cannot install the containerless CLI using Podman as this procedure does not include pulling and unpacking the dependencies that are included in the .zip file.

Prerequisites

  • Red Hat Container Registry Authentication for registry.redhat.io. Red Hat distributes container images from registry.redhat.io, which requires authentication. See Red Hat Container Registry Authentication for additional details.
  • Podman must be installed.
Note

Podman is a daemonless, open source, Linux-native tool designed to make it easy to find, run, build, share, and deploy applications using Open Containers Initiative (OCI) Containers and Container Images. Podman provides a command-line interface (CLI) familiar to anyone who has used the Docker Container Engine. For more information on installing and using Podman, see Podman installation instructions.

Procedure

  1. Use Podman to authenticate to registry.redhat.io by running the following command:

    $ podman login registry.redhat.io
    Copy to Clipboard Toggle word wrap

    Enter the user name and password:

    Username: <username>
    Password: <***********>
    Copy to Clipboard Toggle word wrap
  2. Copy the binary PATH to enable system-wide use by running the following command:

    $ podman cp $(podman create registry.redhat.com/mta-toolkit/mta-mta-cli-rhel9:{ProductVersion}):/usr/local/bin/mta-cli ./
    Copy to Clipboard Toggle word wrap
    Warning

    Although installation using Podman is possible, downloading and installing the .zip file is the preferred installation.

Note

Podman setup and configuration consists of numerous variables that are not within the scope of this documentation. For further details on Podman, see Familiarizing yourself with Podman.

For details on troubelshooting Podman, see A list of common issues and solutions for Podman.

You can install the CLI for use with Docker on Windows. This is the required approach when migrating applications built with .NET framework 4.5 or later on Windows to cross-platform .NET 8.0.

Prerequisites

  • A host with Windows 11+ 64-bit version 21H2 or higher.
  • You have download the Docker Desktop for Windows installer. See Install Docker Desktop on Windows for additional details.

Procedure

  1. Open a PowerShell with Administrator privileges.
  2. Ensure Hyper-V is installed and enabled:

    PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online `
       -FeatureName Microsoft-Hyper-V-All
    Copy to Clipboard Toggle word wrap
    PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online `
       -FeatureName Containers
    Copy to Clipboard Toggle word wrap
    Note

    You may need to reboot Windows.

  3. Install Docker Desktop on Windows.

    1. Double-click Docker_Desktop_Installer.exe to run the installer. By default, Docker Desktop is installed at C:\Program Files\Docker\Docker.
    2. Deselect the Use WSL 2 instead of Hyper-V option on the Configuration page to ensure that Docker will run Windows containers as the backend instead of Linux containers.
  4. In PowerShell, create a folder for MTA:

    PS C:\Users\<your_user_name>> mkdir C:\Users\<your_user_name>\MTA
    Copy to Clipboard Toggle word wrap

    Replace <your_user_name> with the username for your home directory.

  5. Extract the mta-7.2.3-cli-windows.zip file to the MTA folder:

    PS C:\Users\<your_user_name>> cd C:\Users\<your_user_name>\Downloads
    Copy to Clipboard Toggle word wrap

    Replace <your_user_name> with the username for your home directory.

    PS C:\Users\<your_user_name>> Expand-Archive `
       -Path "{ProductShortNameLower}-{ProductVersion}-cli-windows.zip" `
       -DestinationPath "C:\Users\<your_user_name>\MTA"
    Copy to Clipboard Toggle word wrap

    Replace <your_user_name> with the username for your home directory.

  6. Ensure Docker is running Windows containers:

    PS C:\Users\<your_user_name>> docker version
    Copy to Clipboard Toggle word wrap
    Client:
     Version:           27.0.3
     API version:       1.46
     Go version:        go1.21.11
     Git commit:        7d4bcd8
     Built:             Sat Jun 29 00:03:32 2024
     OS/Arch:           windows/amd64 
    1
    
     Context:           desktop-windows
    Server: Docker Desktop 4.32.0 (157355)
     Engine:
      Version:          27.0.3
      API version:      1.46 (minimum version 1.24)
      Go version:       go1.21.11
      Git commit:       662f78c
      Built:            Sat Jun 29 00:02:13 2024
      OS/Arch:          windows/amd64 
    2
    
      Experimental:     false
    Copy to Clipboard Toggle word wrap
    1 2
    Ensure the OS/Arch setting is windows/amd64.
  7. Set the PODMAN_BIN environment variable to use Docker:

    PS C:\Users\<your_user_name>> $env:PODMAN_BIN="C:\Windows\system32\docker.exe"
    Copy to Clipboard Toggle word wrap
  8. Set the DOTNET_PROVIDER_IMG environment variable to use the upstream dotnet-external-provider:

    PS C:\Users\<your_user_name>> $env:DOTNET_PROVIDER_IMG="registry.redhat.io/mta/mta-dotnet-external-provider-rhel9:7.1.0"
    Copy to Clipboard Toggle word wrap
  9. Set the RUNNER_IMG environment variable to use the upstream image:

    # double-check reference
    PS C:\Users\<your_user_name>> $env:RUNNER_IMG="registry.redhat.io/mta/mta-cli-rhel9:7.1.0"
    Copy to Clipboard Toggle word wrap

2.2. Installing MTA on a disconnected environment

Starting from MTA 7.2.0, you can run the application analysis for Java applications in the containerless mode.

Important

The containerless mode is set by default and is used automatically if all requirements are met. For more information, see Running the containerless CLI.

However, if you want to analyze applications in languages other than Java or, for example, use transformation commands, you still need to use containers.

On a connected device, first download and save the MTA binary. Then download and save the Podman images, the MTA CLI image and the provider image that you need.

  • Download the required MTA CLI binary from the Migration Toolkit for Applications Red Hat Developer page:

    • CLI for Linux x86_64
    • CLI for Linux aarch64
    • CLI for MacOS x86_64
    • CLI for MacOS aarch64
    • CLI for Windows x86_64
    • CLI for Windows aarch64
  • On a connected device, download and save the images.
  • Copy the binary to the disconnected device.
  • In addition, you must save and import the associated container images by using Podman.

2.2.1. Downloading the Podman images

Prerequisites

  • Podman installed. For more information, see Podman.

Procedure

  1. Use Podman to authenticate to registry.redhat.io:

    $ podman login registry.redhat.io
    Copy to Clipboard Toggle word wrap
  2. Enter your username and then your password for registry.redhat.io:

    Username: <registry_service_account_username>
    Password: <registry_service_account_password>
    Copy to Clipboard Toggle word wrap

    You should see the following output:

    Login Succeeded!
    Copy to Clipboard Toggle word wrap
  3. Use Podman to pull the image from the registry:

    $ podman pull registry.redhat.io/mta/mta-cli-rhel9:7.1.0
    Copy to Clipboard Toggle word wrap
  4. Use Podman to pull the provider image that you need from the registry:

    1. For Java, run:

      $ podman pull registry.redhat.io/mta/mta-java-external-provider-rhel9:7.1.0
      Copy to Clipboard Toggle word wrap
    2. For .NET, run:

      $ podman pull registry.redhat.io/mta/mta-dotnet-external-provider-rhel9:7.1.0
      Copy to Clipboard Toggle word wrap
  5. Save the images:

    $ podman save <image> -o <my_image.image>
    Copy to Clipboard Toggle word wrap
  6. Copy the .image file and the binary onto a USB or directly to the file system of the disconnected device.
  7. On the disconnected device, run

    $ podman load --input <my_image.image>
    Copy to Clipboard Toggle word wrap

2.2.2. CLI known issues

Limitations with Podman on Microsoft Windows

The CLI is built and distributed with support for Microsoft Windows.

However, when running any container image based on Red Hat Enterprise Linux 9 (RHEL9) or Universal Base Image 9 (UBI9), the following error can be returned when starting the container:

Fatal glibc error: CPU does not support x86-64-v2
Copy to Clipboard Toggle word wrap

This error is caused because Red Hat Enterprise Linux 9 or Universal Base Image 9 container images must be run on a CPU architecture that supports x86-64-v2.

For more details, see (Running Red Hat Enterprise Linux 9 (RHEL) or Universal Base Image (UBI) 9 container images fail with "Fatal glibc error: CPU does not support x86-64-v2").

CLI runs the container runtime correctly. However, different container runtime configurations are not supported.

Although unsupported, you can run CLI with Docker instead of Podman, which would resolve this issue.

To achieve this, you replace the PODMAN_BIN path with the path to Docker.

For example, if you experience this issue, instead of issuing:

PODMAN_BIN=/usr/local/bin/docker mta-cli analyze
Copy to Clipboard Toggle word wrap

You replace PODMAN_BIN with the path to Docker:

<Docker Root Dir>=/usr/local/bin/docker mta-cli analyze
Copy to Clipboard Toggle word wrap

While this is not supported, it would allow you to explore CLI while you work to upgrade your hardware or move to hardware that supports x86_64-v2.

2.3. Running the CLI

Depending on your scenario, you can use the Migration Toolkit for Applications (MTA) CLI to run the analysis in the following ways:

Important

Starting from MTA 7.2.0, you can run the application analysis in the containerless mode. Note that this option is set by default and is used automatically if all requirements are met. For more information, see Running the containerless CLI.

2.3.1. Running the MTA CLI against an application

You can run the Migration Toolkit for Applications (MTA) CLI against an application.

Procedure

  1. Open a terminal and navigate to the <MTA_HOME>/ directory.
  2. Run the mta-cli script, or mta-cli.exe for Windows, and specify the appropriate arguments:

    $ ./mta-cli analyze --input <path_to_input> \
        --output <path_to_output> --source <source_name> --target <target_source> \
    Copy to Clipboard Toggle word wrap
    • --input: The application to be evaluated.
    • --output: The output directory for the generated reports.
    • --source: The source technology for the application migration. For example, weblogic.
    • --target: The target technology for the application migration. For example, eap8.
  3. Access the report.

2.3.1.1. MTA command examples

Running MTA on an application archive

The following command analyzes the example EAR archive named jee-example-app-1.0.0.ear for migrating from JBoss EAP 5 to JBoss EAP 7:

$ <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
Running MTA on source code

The following command analyzes the source code of an example application called customer-management for migrating to JBoss EAP 8.

$ <MTA_HOME>/mta-cli analyze --mode source-only --input <path_to_customer-management>
--output <path_to_report_output> --target eap8
Copy to Clipboard Toggle word wrap
Running cloud-readiness rules

The following command analyzes the example EAR archive named jee-example-app-1.0.0.ear for migrating to JBoss EAP 7. It also evaluates the archive for cloud readiness:

$ <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

You can now run the Migration Toolkit for Applications (MTA) CLI against multiple applications and generate a combined report. This can save you time and give you a better idea of how to prepare a set of applications for migration.

This feature is currently a Developer Preview feature.

Important

Running the CLI against one or more applications is a Developer Preview feature only. Developer Preview features are not supported by Red Hat in any way and are not functionally complete or production-ready. Do not use Developer Preview features for production or business-critical workloads. Developer Preview features provide early access to upcoming product features in advance of their possible inclusion in a Red Hat product offering, enabling customers to test functionality and provide feedback during the development process. These features might not have any documentation, are subject to change or removal at any time, and testing is limited. Red Hat might provide ways to submit feedback on Developer Preview features without an associated SLA.

Procedure

  1. Open a terminal and navigate to the <MTA_HOME>/ directory.
  2. Run the mta-cli script, or mta-cli.exe for Windows, and specify the appropriate arguments, entering one input per analyze command, but entering the same output directory for all inputs. For example, to analyze applications A, B, and C:

    1. Enter the following command for input A:

      $ ./mta-cli analyze --bulk --input=<path_to_input_A> --output=<path_to_output_ABC> --source <source_A> --target <target_A>
      Copy to Clipboard Toggle word wrap
      • --input: The application to be evaluated.
      • --output: The output directory for the generated reports.
      • --source: The source technology for the application migration. For example, weblogic.
      • --target: The target technology for the application migration. For example, eap8.
    2. Enter the following command for input B:

      $ ./mta-cli analyze --bulk --input=<path_to_input_B> --output=<path_to_output_ABC>  --source <source_B> --target <target_B>
      Copy to Clipboard Toggle word wrap
    3. Enter the following command for input C:

      $ ./mta-cli analyze --bulk --input=<path_to_input_C> --output=<path_to_output_ABC>  --source <source_C> --target <target_C>
      Copy to Clipboard Toggle word wrap

      MTA generates a single report, listing all issues that need to be resolved before the applications can be migrated.

  3. Access the report.

2.3.3. Performing analysis using the command line

Analyze supports running source code and binary analysis by using the analyzer-lsp tool. analyzer-lsp evaluates the rules for the providers and determines rule matches.

Note

Extracting the list of dependencies from compiled Java binaries is not always possible during analysis, especially if the dependencies are not embedded within the binary.

To run analysis on application source code, run the following command:

mta-cli analyze --input=<path_to_source_code> --output=<path_to_output_directory>
Copy to Clipboard Toggle word wrap

All flags:

Analyze application source code

Usage:
  mta-cli analyze [flags]

Flags:

      --analyze-known-libraries           Analyze known open-source libraries.
      --context-lines (int)               Number of lines of source code to
                                          include in the output for each
                                          incident (default: `100`).
  -d, --dependency-folders (stringArray)  Directory for dependencies.
      --enable-default-rulesets           Run default rulesets with analysis
                                          (default: `true`).
  -h, --help                              Help for analyze.
      --http-proxy (string)               HTTP proxy string URL.
      --https-proxy (string)              HTTPS proxy string URL.
      --incident-selector (string)        An expression to select incidents
                                          based on custom variables.
                                          Example:
                                          !package=io.demo.config-utils
  -i, --input (string)                    Path to application source code or
                                          a binary.
      --jaeger-endpoint (string)          Jaeger endpoint to collect traces.
      --json-output                       Create analysis and dependency
                                          output as JSON.
      --list-sources                      List available migration sources.
      --list-targets                      List available migration targets.
  -l, --label-selector (string)           Run rules based on specified label
                                          selector expression.
      --maven-settings (string)           Path to the 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`).
      --no-proxy (string)                 Proxy-excluded URLs
                                          (relevant only with proxy).
  -o, --output (string)                   Path to the directory for analysis
                                          output.
      --overwrite                         Overwrite output directory.
      --rules (stringArray)               Filename or directory containing
                                          rule files.
      --run-local                         Run analysis directly on
                                          local system without containers
                                          (for Java and Maven).
                                          Starting from MTA 7.2.0,
                                          containerless CLI is the default
                                          mode (`--run-local=true`).
                                          You can enable container runtime
                                          usage by setting `--run-local` to `false`.
      --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
Note

The list of flags above does not include the --bulk flag because this flag is only offered as part of a Developer Preview feature. That feature is described in Support for providing a single report when analyzing multiple applications on the CLI.

Usage example

  1. Get an example application to run analysis on.
  2. List available target technologies.

    mta-cli analyze --list-targets
    Copy to Clipboard Toggle word wrap
  3. Run an analysis with a specified target technology, for example 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. Several analysis reports are created in your specified output path:

    $ ls ./output/ -1
    analysis.log
    dependencies.yaml
    dependency.log
    output.yaml
    static-report
    Copy to Clipboard Toggle word wrap
    • output.yaml is the file that contains the issues report.
    • static-report contains the static HTML report.
    • dependencies.yaml contains the dependencies report.

2.3.4. Running the containerless CLI

Starting from MTA 7.2.0, you can perform an application analysis for Java applications by using the MTA CLI that does not require installation of a container runtime.

Important

In MTA 7.2.0 and later, containerless CLI is a default mode. To enable container runtime usage, you must set the --run-local flag to false:

--run-local=false
Copy to Clipboard Toggle word wrap

Prerequisites

  • You have OpenJDK version 17 or later installed on your system.
  • You have Maven version 3.9.9 or later installed on your system.
  • The CLI assumes that a path to the mvn binary is correctly registered in the system variable. Therefore, ensure that you added mvn to the following variable:

    • Path for Windows.
    • PATH for Linux and macOS.
  • You have the JAVA_HOME environmental variable set.
  • You have the JVM_MAX_MEM system variable set.

    Note

    If you do not set JVM_MAX_MEM, the analysis might hang.

Procedure for Linux

After unpacking the whole zip file to ~/.kantra, add that path to the $PATH variable.

Note

Moving the mta-cli binary to /usr/bin requires root privileges, whereas adding that path to $PATH variable does not require root privileges.

  1. To extract the dependency zip file to ~/.kantra, run:

    unzip $HOME/mta-cli.<os>.<arch>.zip -d $HOME/.kantra
    Copy to Clipboard Toggle word wrap
  2. Add as a system-wide binary or add to the global $PATH variable:

    1. For example, to add the mta-cli binary to /usr/bin as a system-wide binary, using sudo, run:

      sudo mv ~/.kantra/mta-cli /usr/bin/
      Copy to Clipboard Toggle word wrap
    2. For example, to add to the global $PATH variable, run:

      export PATH=$HOME/.kantra:$PATH
      Copy to Clipboard Toggle word wrap
    Note

    The CLI can run with the requirements moved to the directory from which you run an analysis. During the analysis, the CLI checks for the requirements in this directory first, and if it does not find the requirements, it searches for them in the $HOME/.kantra directory.

  3. Optional: Display all mta-cli analyze command options:

    mta-cli analyze --help
    Copy to Clipboard Toggle word wrap
  4. Run the application analysis:

    $ mta-cli analyze --overwrite --input <path_to_input>  --output <path_to_output> --target <target_source>
    Copy to Clipboard Toggle word wrap

    The command arguments represent the following:

    • --overwrite: Overwrites the output folder if it exists.
    • --input: The application to be analyzed.
    • --output: The output directory for the generated reports.
    • --target: The target technology for the application migration, for example, eap8.

2.3.5. Performing transformation by using the command line

You can use transformation to perform the following actions:

  • Transform Java applications source code by using the transform openrewrite command.
  • Convert XML rules to YAML rules by using the transform rules command.
Important

Performing transformation requires the container runtime to be configured. For more information, see Installing the CLI by using Podman.

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 clean up temporary resources

Use "mta-cli transform [command] --help" for more information about a command.
Copy to Clipboard Toggle word wrap

2.3.5.1. OpenRewrite

The openrewrite subcommand allows running OpenRewrite recipes on source code.

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 clean up temporary resources
Copy to Clipboard Toggle word wrap

To run transform openrewrite on application source code, run the following command:

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

Note

You can only use a single target to run the transform overwrite command.

2.3.5.2. Rules

You can use the rules subcommand of the transform command to convert mta XML rules to analyzer-lsp YAML rules. To covert rules, the rules subcommand uses the windup-shim tool.

Note

analyzer-lsp evaluates the rules for the providers and determines rule matches.

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

To run transform rules on application source code, run the following:

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

Usage example

  1. Get an example application to transform source code.
  2. View the available OpenRewrite recipes.

    mta-cli transform openrewrite --list-targets
    Copy to Clipboard Toggle word wrap
  3. Run a recipe on the example application.

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

    Inspect the jakartaee-duke application source code diff to see the transformation.

2.3.5.3. Available OpenRewrite recipes

Expand
Table 2.1. Available OpenRewrite recipes
Migration pathPurposerewrite.configLocationactiveRecipes

Java EE to Jakarta EE

Replace import of javax packages with equivalent jakarta packages

Replace javax artifacts, declared within pom.xml files, with the jakarta equivalents

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

org.jboss.windup.JavaxToJakarta

Java EE to Jakarta EE

Rename bootstrapping files

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

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

Java EE to Jakarta EE

Transform persistence.xml configuration

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

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

Spring Boot to Quarkus

Replace spring.jpa.hibernate.ddl-auto property within files matching application*.properties

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

org.jboss.windup.sb-quarkus.Properties

2.4. Accessing reports

When you run the Migration Toolkit for Applications, a report is generated in the <OUTPUT_REPORT_DIRECTORY> that you specify using the --output argument in the command line.

The output directory contains the following files and subdirectories:

<OUTPUT_REPORT_DIRECTORY>/
├── index.html          // Landing page for the report
├── <EXPORT_FILE>.csv   // Optional export of data in CSV format
├── archives/           // Archives extracted from the application
├── mavenized/          // Optional Maven project structure
├── reports/            // Generated HTML reports
├── stats/              // Performance statistics
Copy to Clipboard Toggle word wrap

Procedure

  1. Obtain the path of the index.html file of your report from the output that appears after you run MTA:

    Report created: <OUTPUT_REPORT_DIRECTORY>/index.html
                  Access it at this URL: file:///<OUTPUT_REPORT_DIRECTORY>/index.html
    Copy to Clipboard Toggle word wrap
  2. Open the index.html file by using a browser.

    The generated report is displayed.

2.5. Analyzing multi-language applications with CLI

Starting from MTA 7.1.0, you can run the application analysis on applications written in multiple languages. You can perform the analysis either of the following ways:

  • Select the supported language provider to run the analysis for.
  • Override the existing supported language provider with your own unsupported language provider and run the analysis for this unsupported provider.

When analyzing a multi-language application with Migration Toolkit for Applications (MTA) CLI, you can explicitly set a supported language provider according to your application language to run the analysis for.

Prerequisites

  • You are running the latest version of MTA CLI.

Procedure

  1. List language providers supported for the analysis:

    $ mta-cli analyze --list-providers
    Copy to Clipboard Toggle word wrap
  2. Run the application analysis for the selected language provider:

    $ mta-cli analyze --input <_path_to_the_source_repository_> --output <_path_to_the_output_directory_> --provider <_language_provider_> --rules <_path_to_custom_rules_>
    Copy to Clipboard Toggle word wrap

    Note that if you do not set the --provider option, the analysis might fail because it detects unsupported providers. The analysis will complete without --provider only if all discovered providers are supported.

When analyzing a multi-language application with Migration Toolkit for Applications (MTA) CLI, you can run the analysis for an unsupported language provider. To do so, you must override an existing supported language provider with your own unsupported language provider by using the --override-provider-settings option.

Important

You must create a configuration file for your unsupported language provider before overriding the supported provider.

Prerequisites

  • You created a configuration file for your unsupported language provider.

Procedure

  • Override an existing supported language provider with your unsupported provider:

    $ mta-cli analyze --override-provider-settings <path_to_configuration_file> --output=<path_to_the_output_directory> --rules <path_to_custom_rules>
    Copy to Clipboard Toggle word wrap
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat