Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Installing and Running the CLI
2.1. Installing the CLI Copiar o linkLink copiado para a área de transferência!
You can install the CLI on Linux, Windows, or macOS operating systems.
Prerequisites
-
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
PodmanPodman 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.
2.1.1. Installing the CLI .zip file Copiar o linkLink copiado para a área de transferência!
Procedure
To install using the downloadable .zip file:
Navigate to the MTA Download page and download the OS-specific CLI file or the
srcfile:- mta-7.0.3-cli-linux.zip
- mta-7.0.3-cli-macos.zip
- mta-7.0.3-cli-windows.zip
- mta-7.0.3-cli-src.zip
Extract the
.zipfile to a directory of your choice. The.zipfile extracts a single binary, called mta-cli.When you encounter
<MTA_HOME>in this guide, replace it with the actual path to your MTA installation.
2.1.2. Installing the CLI using Podman Copiar o linkLink copiado para a área de transferência!
Prerequisites
-
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.
Procedure
To install using podman pull:
To use Podman to authenticate to registry.redhat.io:
podman login registry.redhat.io Username: <username> Password: <***********>
podman login registry.redhat.io Username: <username> Password: <***********>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Issue:
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 This command will copy the binary
PATHfor system-wide use.WarningAlthough installation using Podman is possible, downloading and installing the
.zipfile is the preferred installation.
2.1.3. CLI known issues Copiar o linkLink copiado para a área de transferência!
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.2. Running the CLI Copiar o linkLink copiado para a área de transferência!
You can run MTA against your application.
Procedure
-
Open a terminal and navigate to the
<MTA_HOME>/directory. Execute the
mta-cliscript, ormta-cli.exefor Windows, and specify the appropriate arguments:./mta-cli analyze --input /path/to/jee-example-app-1.0.0.ear \ --output /path/to/output --source weblogic --target eap6 \$ ./mta-cli analyze --input /path/to/jee-example-app-1.0.0.ear \ --output /path/to/output --source weblogic --target eap6 \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.
-
- Access the report.
2.2.1. MTA command examples Copiar o linkLink copiado para a área de transferência!
Running MTA on an application archive
The following command analyzes the jee-example-app-1.0.0.ear example EAR archive 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 seam-booking-5.2 example source code for migrating to JBoss EAP 6.
<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
$ <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
Running cloud-readiness rules
The following command analyzes the jee-example-app-1.0.0.ear example EAR archive for migrating to JBoss EAP 7. It also evaluates 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.2.2. Performing analysis using the command line Copiar o linkLink copiado para a área de transferência!
Analyze allows running source code and binary analysis using analyzer-lsp.
To run analysis on application source code, run the following command:
mta-cli analyze --input=<path/to/source/code> --output=<path/to/output/dir>
mta-cli analyze --input=<path/to/source/code> --output=<path/to/output/dir>
All flags:
Usage example
- Get an example application to run analysis on.
List available target technologies.
mta-cli analyze --list-targets
mta-cli analyze --list-targetsCopy 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-readinessCopy 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 a dependencies report.
2.2.3. Performing transformation using the command line Copiar o linkLink copiado para a área de transferência!
Transform has two sub commands - openrewrite and rules.
2.2.3.1. OpenRewrite Copiar o linkLink copiado para a área de transferência!
The openrewrite sub command 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.2.3.2. Rules Copiar o linkLink copiado para a área de transferência!
The rules sub command allows converting mta XML rules to analyzer-lsp YAML rules using windup-shim.
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-targetsCopy 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-importsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect the
jakartaee-dukeapplication source code diff to see the transformation
2.2.3.3. Available OpenRewrite recipes Copiar o linkLink copiado para a área de transferência!
| 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.3. Accessing reports Copiar o linkLink copiado para a área de transferência!
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.htmlfile 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.htmlReport created: <OUTPUT_REPORT_DIRECTORY>/index.html Access it at this URL: file:///<OUTPUT_REPORT_DIRECTORY>/index.htmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Open the
index.htmlfile by using a browser.The generated report is displayed.