Este contenido no está disponible en el idioma seleccionado.
Chapter 2. Installing and Running the CLI
2.1. Installing the CLI Copiar enlaceEnlace copiado en el portapapeles!
You can install the CLI on Linux, Windows, or macOS operating systems using the downloadable .zip
file.
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 fromregistry.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 thePATH
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 be2048
or greater.
-
The value of
2.1.1. Installing the CLI .zip file Copiar enlaceEnlace copiado en el portapapeles!
Procedure
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
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 Copiar enlaceEnlace copiado en el portapapeles!
You can install the containerized CLI using podman pull
.
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 fromregistry.redhat.io
, which requires authentication. See Red Hat Container Registry Authentication for additional details. - Podman must be installed.
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
Use Podman to authenticate to
registry.redhat.io
by running the following command:podman login registry.redhat.io
$ podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the user name and password:
Username: <username> Password: <***********>
Username: <username> Password: <***********>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 ./
$ podman cp $(podman create registry.redhat.com/mta-toolkit/mta-mta-cli-rhel9:{ProductVersion}):/usr/local/bin/mta-cli ./
Copy to Clipboard Copied! Toggle word wrap Toggle overflow WarningAlthough installation using Podman is possible, downloading and installing the
.zip
file is the preferred installation.
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.
2.1.3. Installing the CLI for use with Docker on Windows (Developer Preview) Copiar enlaceEnlace copiado en el portapapeles!
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
- Open a PowerShell with Administrator privileges.
Ensure Hyper-V is installed and enabled:
PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online ` -FeatureName Microsoft-Hyper-V-All
PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online ` -FeatureName Microsoft-Hyper-V-All
Copy to Clipboard Copied! Toggle word wrap Toggle overflow PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online ` -FeatureName Containers
PS C:\Users\<your_user_name>> Enable-WindowsOptionalFeature -Online ` -FeatureName Containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou may need to reboot Windows.
Install Docker Desktop on Windows.
-
Double-click
Docker_Desktop_Installer.exe
to run the installer. By default, Docker Desktop is installed atC:\Program Files\Docker\Docker
. - 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.
-
Double-click
In PowerShell, create a folder for MTA:
PS C:\Users\<your_user_name>> mkdir C:\Users\<your_user_name>\MTA
PS C:\Users\<your_user_name>> mkdir C:\Users\<your_user_name>\MTA
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<your_user_name>
with the username for your home directory.Extract the
mta-7.2.3-cli-windows.zip
file to theMTA
folder:PS C:\Users\<your_user_name>> cd C:\Users\<your_user_name>\Downloads
PS C:\Users\<your_user_name>> cd C:\Users\<your_user_name>\Downloads
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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"
PS C:\Users\<your_user_name>> Expand-Archive ` -Path "{ProductShortNameLower}-{ProductVersion}-cli-windows.zip" ` -DestinationPath "C:\Users\<your_user_name>\MTA"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<your_user_name>
with the username for your home directory.Ensure Docker is running Windows containers:
PS C:\Users\<your_user_name>> docker version
PS C:\Users\<your_user_name>> docker version
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
PODMAN_BIN
environment variable to use Docker:PS C:\Users\<your_user_name>> $env:PODMAN_BIN="C:\Windows\system32\docker.exe"
PS C:\Users\<your_user_name>> $env:PODMAN_BIN="C:\Windows\system32\docker.exe"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
DOTNET_PROVIDER_IMG
environment variable to use the upstreamdotnet-external-provider
:PS C:\Users\<your_user_name>> $env:DOTNET_PROVIDER_IMG="registry.redhat.io/mta/mta-dotnet-external-provider-rhel9:7.1.0"
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 Copied! Toggle word wrap Toggle overflow Set the
RUNNER_IMG
environment variable to use the upstream image:double-check reference
# 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 Copied! Toggle word wrap Toggle overflow
2.2. Installing MTA on a disconnected environment Copiar enlaceEnlace copiado en el portapapeles!
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.
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 Copiar enlaceEnlace copiado en el portapapeles!
Prerequisites
- Podman installed. For more information, see Podman.
Procedure
Use Podman to authenticate to registry.redhat.io:
podman login registry.redhat.io
$ podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter your username and then your password for registry.redhat.io:
Username: <registry_service_account_username> Password: <registry_service_account_password>
Username: <registry_service_account_username> Password: <registry_service_account_password>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You should see the following output:
Login Succeeded!
Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use Podman to pull the image from the registry:
podman pull registry.redhat.io/mta/mta-cli-rhel9:7.1.0
$ podman pull registry.redhat.io/mta/mta-cli-rhel9:7.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use Podman to pull the provider image that you need from the registry:
For Java, run:
podman pull registry.redhat.io/mta/mta-java-external-provider-rhel9:7.1.0
$ podman pull registry.redhat.io/mta/mta-java-external-provider-rhel9:7.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For .NET, run:
podman pull registry.redhat.io/mta/mta-dotnet-external-provider-rhel9:7.1.0
$ podman pull registry.redhat.io/mta/mta-dotnet-external-provider-rhel9:7.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Save the images:
podman save <image> -o <my_image.image>
$ podman save <image> -o <my_image.image>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the
.image
file and the binary onto a USB or directly to the file system of the disconnected device. On the disconnected device, run
podman load --input <my_image.image>
$ podman load --input <my_image.image>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.2. CLI known issues Copiar enlaceEnlace copiado en el portapapeles!
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
Fatal glibc error: CPU does not support x86-64-v2
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
PODMAN_BIN=/usr/local/bin/docker mta-cli analyze
You replace PODMAN_BIN
with the path to Docker:
<Docker Root Dir>=/usr/local/bin/docker mta-cli analyze
<Docker Root Dir>=/usr/local/bin/docker mta-cli analyze
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 Copiar enlaceEnlace copiado en el portapapeles!
Depending on your scenario, you can use the Migration Toolkit for Applications (MTA) CLI to run the analysis in the following ways:
- Run the analysis against a single application.
Run the analysis against multiple applications:
-
In MTA versions earlier than 7.1.0, you can enter a series of
--analyze
commands, each against an application and each generating a separate report. For more information, see Running the MTA CLI against an application. -
In MTA 7.1.0 and later, you can use the
--bulk
option to analyze multiple applications at once and generate a single report. Note that this feature is a Developer Preview feature only. For more information, see Running the MTA CLI against multiple applications and generating a single report (Developer Preview).
-
In MTA versions earlier than 7.1.0, you can enter a series of
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 Copiar enlaceEnlace copiado en el portapapeles!
You can run the Migration Toolkit for Applications (MTA) CLI against an application.
Procedure
-
Open a terminal and navigate to the
<MTA_HOME>/
directory. Run the
mta-cli
script, ormta-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> \
$ ./mta-cli analyze --input <path_to_input> \ --output <path_to_output> --source <source_name> --target <target_source> \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
--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
.
-
- Access the report.
2.3.1.1. MTA command examples Copiar enlaceEnlace copiado en el portapapeles!
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 \
$ <MTA_HOME>/mta-cli analyze \
--input <path_to_jee-example-app-1.0.0.ear> \
--output <path_to_report_output> --source eap5 --target eap7 \
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>
$ <MTA_HOME>/mta-cli analyze --mode source-only --input <path_to_customer-management>
--output <path_to_report_output> --target eap8
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
$ <MTA_HOME>/mta-cli analyze --input <path_to_jee-example-app-1.0.0.ear> \
--output <path_to_report_output> \
--target eap7
2.3.2. Running the MTA CLI against multiple applications and generating a single report (Developer Preview) Copiar enlaceEnlace copiado en el portapapeles!
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.
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
-
Open a terminal and navigate to the
<MTA_HOME>/
directory. Run the
mta-cli
script, ormta-cli.exe
for Windows, and specify the appropriate arguments, entering one input peranalyze
command, but entering the same output directory for all inputs. For example, to analyze applications A, B, and C: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>
$ ./mta-cli analyze --bulk --input=<path_to_input_A> --output=<path_to_output_ABC> --source <source_A> --target <target_A>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
--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
.
-
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>
$ ./mta-cli analyze --bulk --input=<path_to_input_B> --output=<path_to_output_ABC> --source <source_B> --target <target_B>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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>
$ ./mta-cli analyze --bulk --input=<path_to_input_C> --output=<path_to_output_ABC> --source <source_C> --target <target_C>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow MTA generates a single report, listing all issues that need to be resolved before the applications can be migrated.
- Access the report.
2.3.3. Performing analysis using the command line Copiar enlaceEnlace copiado en el portapapeles!
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.
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>
mta-cli analyze --input=<path_to_source_code> --output=<path_to_output_directory>
All flags:
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
- Get an example application to run analysis on.
List available target technologies.
mta-cli analyze --list-targets
mta-cli analyze --list-targets
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
mta-cli analyze --input=<path-to/example-applications/example-1> --output=<path-to-output-dir> --target=cloud-readiness
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Several analysis reports are created in your specified output path:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
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 Copiar enlaceEnlace copiado en el portapapeles!
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.
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
--run-local=false
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 addedmvn
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.NoteIf 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.
Moving the mta-cli
binary to /usr/bin
requires root privileges, whereas adding that path to $PATH
variable does not require root privileges.
To extract the dependency zip file to
~/.kantra
, run:unzip $HOME/mta-cli.<os>.<arch>.zip -d $HOME/.kantra
unzip $HOME/mta-cli.<os>.<arch>.zip -d $HOME/.kantra
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add as a system-wide binary or add to the global
$PATH
variable:For example, to add the
mta-cli
binary to/usr/bin
as a system-wide binary, usingsudo
, run:sudo mv ~/.kantra/mta-cli /usr/bin/
sudo mv ~/.kantra/mta-cli /usr/bin/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, to add to the global
$PATH
variable, run:export PATH=$HOME/.kantra:$PATH
export PATH=$HOME/.kantra:$PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
NoteThe 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.Optional: Display all
mta-cli analyze
command options:mta-cli analyze --help
mta-cli analyze --help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the application analysis:
mta-cli analyze --overwrite --input <path_to_input> --output <path_to_output> --target <target_source>
$ mta-cli analyze --overwrite --input <path_to_input> --output <path_to_output> --target <target_source>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 Copiar enlaceEnlace copiado en el portapapeles!
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.
Performing transformation requires the container runtime to be configured. For more information, see Installing the CLI by using Podman.
2.3.5.1. OpenRewrite Copiar enlaceEnlace copiado en el portapapeles!
The openrewrite
subcommand allows running OpenRewrite
recipes on source code.
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>
mta-cli transform openrewrite --input=<path/to/source/code> --target=<exactly_one_target_from_the_list>
You can only use a single target to run the transform overwrite
command.
2.3.5.2. Rules Copiar enlaceEnlace copiado en el portapapeles!
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.
analyzer-lsp
evaluates the rules for the providers and determines rule matches.
To run transform rules
on application source code, run the following:
mta-cli transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir>
mta-cli transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir>
Usage example
- Get an example application to transform source code.
View the available OpenRewrite recipes.
mta-cli transform openrewrite --list-targets
mta-cli transform openrewrite --list-targets
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run a recipe on the example application.
mta-cli transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-imports
mta-cli transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-imports
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect the
jakartaee-duke
application source code diff to see the transformation.
2.3.5.3. Available OpenRewrite recipes Copiar enlaceEnlace copiado en el portapapeles!
Migration path | Purpose | rewrite.configLocation | activeRecipes |
---|---|---|---|
Java EE to Jakarta EE |
Replace import of
Replace |
|
|
Java EE to Jakarta EE | Rename bootstrapping files |
|
|
Java EE to Jakarta EE |
Transform |
|
|
Spring Boot to Quarkus |
Replace |
|
|
2.4. Accessing reports Copiar enlaceEnlace copiado en el portapapeles!
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:
Procedure
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
Report created: <OUTPUT_REPORT_DIRECTORY>/index.html Access it at this URL: file:///<OUTPUT_REPORT_DIRECTORY>/index.html
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open the
index.html
file by using a browser.The generated report is displayed.
2.5. Analyzing multi-language applications with CLI Copiar enlaceEnlace copiado en el portapapeles!
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.
2.5.1. Analyzing a multi-language application for the selected supported language provider Copiar enlaceEnlace copiado en el portapapeles!
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
List language providers supported for the analysis:
mta-cli analyze --list-providers
$ mta-cli analyze --list-providers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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_>
$ 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 Copied! Toggle word wrap Toggle overflow 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.
2.5.2. Analyzing a multi-language application for an unsupported language provider Copiar enlaceEnlace copiado en el portapapeles!
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.
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>
$ mta-cli analyze --override-provider-settings <path_to_configuration_file> --output=<path_to_the_output_directory> --rules <path_to_custom_rules>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow