Visual Studio Code Extension Guide
Using the Migration Toolkit for Applications extension for Visual Studio Code to identify and resolve migration issues.
Abstract
- Making open source more inclusive
- 1. Introduction to the MTA extension for Microsoft Visual Code
- 2. Installing the MTA extension for Visual Studio Code
- 3. Configuring the .kantra directory
- 4. MTA Visual Studio Code extension interface
- 5. Configuring and running an application analysis
- 6. Reviewing and resolving migration issues
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Introduction to the MTA extension for Microsoft Visual Code
You can migrate and modernize applications by using the Migration Toolkit for Applications (MTA) extension for Microsoft Visual Studio Code.
The MTA extension can perform the following actions:
- Analyze your projects with customizable rulesets.
- Mark issues in the source code.
- Provide guidance to fix the issues.
- Perform automatic code replacement, if possible.
The MTA extension is also compatible with Visual Studio Codespaces, the Microsoft cloud-hosted development environment.
Chapter 2. Installing the MTA extension for Visual Studio Code
You can install the MTA extension for Visual Studio Code (VS Code).
Prerequisites
You installed the Java Development Kit (JDK). MTA supports the following JDKs:
- Oracle JDK 17 or later.
- Eclipse Temurin™ JDK 17 or later.
- OpenJDK 17 or later.
- You have 8 GB of RAM available.
-
For macOS installation, you have the value of
maxproc
set to2048
or greater.
Procedure
Set the
JAVA_HOME
environmental variable:$ export JAVA_HOME=jdk11
- In VS Code, click the Extensions icon on the Activity bar to open the Extensions view.
-
Enter
Migration Toolkit for Applications
in the Search field. Select the Migration Toolkit for Applications extension and click Install.
The MTA extension icon (
) is displayed on the Activity bar.
Chapter 3. Configuring the .kantra directory
Starting from Migration Toolkit for Applications (MTA) 7.2.0, you can perform an application analysis in the containerless mode. Before running the analysis, you must create and configure the .kantra
directory.
Prerequisites
- You installed the MTA extension version 7.2.0 or later on your system. For more information, see Installing the MTA extension for Visual Studio Code.
- You installed the MTA distribution version 7.2.0 or later. For more information, see Installing the CLI .zip file.
Procedure
Create a directory named
.kantra
in your$HOME
directory:$ mkdir ~/.kantra/
Move all the files from the extracted MTA directory, except the
mta-cli
binary, into the~/.kantra
directory.$ mv !(mta-cli) ~/.kantra/
Verification
-
Verify that you created and configured the
.kantra
directory correctly by running the application analysis. For more information, see Configuring and running an application analysis.
Chapter 4. MTA Visual Studio Code extension interface
The interface of the Migration Toolkit for Applications (MTA) extension for Visual Studio Code is designed to make it easier for you to find information and perform the required actions:
In the left pane, you can see the Analysis Results directory tree that includes the following elements:
- A report icon. You can click the icon to open the MTA report in your browser.
- The applications analyzed by MTA.
- The rulesets used for the analysis.
- The issues discovered by the analysis.
- In the upper right pane, you can configure an analysis.
- In the lower right pane, you can see the settings of the configuration, including source, target, and advanced options. You can view the progress of an analysis in this pane. When the analysis is completed, you can click the Open Report button to open the MTA report, which describes any issues you need to address before you migrate or modernize your application. For more information, see Reviewing an analysis report.
Chapter 5. Configuring and running an application analysis
To analyze an application with the MTA extension for Visual Studio Code, you must create a run configuration first. You can configure multiple run configurations to run against each project you import to Visual Studio Code.
Prerequisites
-
You installed the
mta-cli
executable. You can downloadmta-cli
from the MTA download page.
Procedure
-
In Extensions view, click the Migration Toolkit for Applications icon (
) on the Activity bar.
- Click the plus sign (+) next to Migration Toolkit for Applications to add a run configuration.
Specify the following configuration fields:
- Name: Enter a name for the analysis configuration or accept the default suggestion.
-
cli: Enter the path to the
mta-cli
executable, for example:$HOME/mta-cli-7.3.1.GA-redhat/bin/mta-cli
. Input: Set to the path of the project that you have open within your IDE:
- Click Add.
Perform one of the following actions:
- Enter the input file or directory and press Enter.
- Click Open File Explorer and select the directory.
- Target: Select one or more target migration paths.
Right-click the run configuration and select Run.
When the analysis is completed, you can click the Open Report button to open the MTA report, which describes the issues you need to address before you migrate or modernize your application. For more information, see Reviewing an analysis report.
Chapter 6. Reviewing and resolving migration issues
You can use the MTA extension icons to prioritize issues based on their severity.
Procedure
- Select a run configuration directory on the left pane.
- Expand its folders to view the Hints generated for each application file.
- Select a hint to view the source code.
- Right-click a hint and select View Details to view the Rule ID and other information.
Prioritize issues based on the following icons, which are displayed next to each hint:
-
: You must fix the issue for a successful migration.
-
: You might need to address the issue during the migration.
-
Resolve issues by editing the code of a file with a hint:
- In the left pane, right-click an issue and select Open Code.
- Make any changes needed to the code and save the file.
- Optional: Right-click the issue and select Mark as Complete or Delete.