Chapter 4. Analyzing Java applications with MTA command-line interface


Depending on your scenario, you can use the Migration Toolkit for Applications (MTA) CLI to perform the following actions:

  • 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 version 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 Analyzing multiple applications.
Important

Starting from MTA version 7.2.0, you can run the application analysis for Java applications in the containerless mode. Note that this option is set by default and is used automatically only if all requirements are met. For more information, see Analyzing an application in the containerless mode.

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

Note

The analysis output in the disconnected environment usually results in fewer incidents because a dependency analysis does not run accurately without access to Maven.

MTA CLI supports running source code and binary analysis by using analyzer-lsp. analyzer-lsp is a tool that evaluates rules by using language providers.

4.1. Analyzing a single application

You can use the Migration Toolkit for Applications (MTA) CLI to perform an application analysis for a single application.

Note

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

Procedure

  1. Optional: List available target technologies for an analysis:

    $ mta-cli analyze --list-targets
    Copy to Clipboard Toggle word wrap
  2. Run the analysis:

    $ mta-cli analyze --input <path_to_input> --output <path_to_output> --source <source_name> --target <target_name>
    Copy to Clipboard Toggle word wrap

    Specify the following arguments:

    • --input: An application to be evaluated.
    • --output: An output directory for the generated reports. mta-cli analyze creates the following analysis reports:

      ./
      ├── analysis.log
      ├── dependencies.yaml
      ├── output.yaml
      ├── shim.log
      ├── static-report
      └── static-report.log
      Copy to Clipboard Toggle word wrap
    • --source: A source technology for the application migration, for example, weblogic.
    • --target: A target technology for the application migration, for example, eap8.
  3. Access the generated analysis report:

    1. In the output of the mta-cli analyze command, copy a path to the index.html analysis report file:

      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. Paste the path to the browser of your choice.

    Alternatively, press Ctrl and click on the path to the report file.

4.2. Analyzing multiple applications

You can use the Migration Toolkit for Applications (MTA) CLI to perform an application analysis for multiple applications at once and generate a combined report.

Important

Analyzing multiple 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. Run the analysis for multiple applications.

    Important

    You must enter one input per analyze command, but make sure to enter the same output directory for all inputs.

    For example, to analyze example applications A, B, and C, enter the following commands:

    1. For input A, enter:

      $ 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
    2. For input B, enter:

      $ 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. For input C, enter:

      $ 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
  2. Access the analysis report. MTA generates a single report, listing all issues that must be resolved before the applications can be migrated.

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 for the analysis of Java applications, you must set the --run-local flag to false:

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

The analysis for other applications runs in the container mode automatically

Prerequisites

  • You installed the MTA CLI. For more information, see Installing the CLI by using a .zip file.
  • You installed Java Development Kit (JDK) version 17 or later.
  • If you use OpenJDK on Red Hat Enterprise Linux (RHEL) or Fedora, you installed the Java devel package.
  • You installed Maven version 3.9.9 or later.
  • 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 set the JAVA_HOME environmental variable.
  • You set the JVM_MAX_MEM system variable.

    Note

    If you do not set JVM_MAX_MEM, the analysis might hang because Java might require more memory than the default JVM_MAX_MEM value.

  • For Gradle analysis:

    • You installed OpenJDK version 8.
    • You set $JAVA8_HOME and it is pointing to the OpenJDK 8 home directory.
    • Your project has a Gradle wrapper.

Procedure

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

    $ mta-cli analyze --help
    Copy to Clipboard Toggle word wrap
  2. 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
    Note

    The --overwrite option overwrites the output folder if it exists.

4.4. The analyze command options

The following are the options that you can use together with the mta-cli analyze command to adjust the command behavior to your needs.

Expand
Table 4.1. mta-cli analyze command options
OptionDescription

--analyze-known-libraries (bool)

Analyze open-source libraries.

--disable-maven-search

Set --disable-maven-search=true to disable MTA from relying on the Maven search index to determine if a dependency is publicly available (such as an open-source dependency) or internal to the Java binary application during analysis.

When you disable Maven search, MTA at first tries to determine dependencies from the the JAR file’s POM file (if any). If this method does not succeed, MTA goes through the directory structure to determine dependencies. This method may not produce a reliable dependency classification since the package structure can differ from what is expected by MTA. You may see more number of incidents because some dependencies may be wrongly classified as internal.

By default, --disable-maven-search=false. Therefore, MTA uses the SHA digest of the JAR file to search the Maven search index. This setting generates more accurate dependencies but the drawback is that the Maven search index is frequently unavailable.

--context-lines (int)

The number of lines of source code to include in the output for each incident. The default is 100.

--dependency-folders (stringArray)

A directory for dependencies.

--enable-default-rulesets (bool)

Run default rulesets with analysis. The default is true.

--help

Display the available flags for the analyze command.

--http-proxy (string)

An HTTP proxy string URL.

--https-proxy (string)

An HTTPS proxy string URL.

--incident-selector (string)

An expression to select incidents based on custom variables, for example:

!package=io.demo.config-utils
Copy to Clipboard Toggle word wrap

--input (string)

A path to the application source code or a binary.

--jaeger-endpoint (string)

A Jaeger endpoint to collect traces.

--json-output (string)

Create analysis and dependence output as a JSON file.

--label-selector (string)

Run rules based on specified label selector expression.

--list-languages

List all languages in the source application. This flag is not supported for binary applications.

--list-providers

List available supported providers.

--list-sources

List rules for available migration sources.

--list-targets

List rules for available migration targets.

--maven-settings (string)

A path to the custom Maven settings file to use.

--mode (string)

An analysis mode. Must be set to either of the following values:

  • full (default)
  • source-only

--no-proxy (string)

Proxy-excluded URLs (relevant only with proxy).

--output (string)

A path to the directory for analysis output.

--overwrite (bool)

Overwrite the output directory.

--rules (stringArray)

A filename or directory that contains rule files.

--skip-static-report (bool)

Do not generate the static report.

--source (string)

A source technology to consider for the analysis. To specify multiple sources, repeat the parameter, for example:

--source <source_1> --source <source_2> ...
Copy to Clipboard Toggle word wrap

--target (string)

A target technology to consider for the analysis. To specify multiple targets, repeat the parameter, for example:

--target <target_1> --target <target_2> ...
Copy to Clipboard Toggle word wrap

--log-level uint32

A log level. The default is 4.

--no-cleanup (bool)

Do not clean up temporary resources.

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat