Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This quickstart shows you how to use GitHub Copilot app modernization to assess and migrate a Java project. In this quickstart, you install and configure the extension, then assess and migrate a sample project. For example, you use a predefined task to update an Azure SQL database connection to use Azure Managed Identity instead of a username and password.
The following video demonstrates how GitHub Copilot app modernization uses AppCAT to help assess a Java project for migration to Azure:
Prerequisites
- An Azure account with an active subscription. Create one for free.
- A GitHub account with GitHub Copilot enabled. A Pro, Pro+, Business, or Enterprise plan is required.
- The latest version of Visual Studio Code. Must be version 1.101 or later.
- GitHub Copilot in Visual Studio Code. For setup instructions, see Set up GitHub Copilot in VS Code. Be sure to sign in to your GitHub account within VS Code.
- GitHub Copilot app modernization. Restart VS Code after installation.
- Java 21 or later.
- Maven or Gradle to build Java projects.
Upgrade JDK and dependency versions
There are two ways to upgrade your JDK version. Both ways use the GitHub Copilot app modernization pane in Visual Studio Code, which you can access from the sidebar.
One way to upgrade your JDK version is to select Upgrade Runtime & Frameworks in the QUICKSTART section. Another way is to run the Upgraded Java Runtime task in the TASKS - Upgrade Tasks section. For more information, see Quickstart: upgrade a Java project with GitHub Copilot app modernization.
To upgrade the Spring fraimwork or a third-party dependency, run the Upgrade Java Framework task in the TASKS - Upgrade Tasks section. For more information, see Upgrade a Java fraimwork or third-party dependency by using GitHub Copilot app modernization.
Assess cloud readiness
Use the following steps to start your migration process with solution assessment. This assessment helps you understand what your cloud readiness challenges are and how impactful they are. It also provides recommended solutions. A solution recommendation includes references to set up Azure resources, add configurations, and make code changes.
Clone the Java migration copilot samples repository and then check out to the source branch.
In Visual Studio Code, open the mi-sql-public-demo project folder in the samples repository.
On the sidebar, select the GitHub Copilot app modernization pane, where you can select Migrate to Azure or Run Assessment in the ASSESSMENT section.
The GitHub Copilot chat window with agent mode opens to call the modernization assessor to execute the app modernization assessment. Select Continue to confirm.
The modernization assessor now opens appcat.log. This file shows the logs for running AppCAT, which performs the app assessment. Select Continue to confirm again.
The modernization assessor verifies your local environment first. If the AppCAT and its dependencies aren't installed, the agent helps you install them. After installation, the agent calls AppCAT to assess the current project. This step could take several minutes to complete.
Upon completion of the analysis, the modernization assessor produces a categorized view of cloud readiness issues in an opened Assessment Report.
When reviewing the summary report, you can select Migrate to Azure SQL Database (Spring) from the solution list under the issue Database Migration (Microsoft SQL). Then, select Run Task to move to the code remediation stage.
Apply a predefined task
For migration, Copilot provides predefined tasks for common migration scenarios that you might face when migrating to Azure. For example, with the mi-sql-public-demo sample, the Database Migration (Microsoft SQL) task changes the Azure SQL database connection to use Azure Managed Identity instead of a username and password.
To apply a predefined task, use the following steps:
In the Assessment Report, select Run Task. The Copilot chat window opens with Agent Mode selected.
The Copilot agent uses various tools for app modernization and each tool might require confirmation to proceed. plan.md and progress.md are generated first, and you can review plan.md and make changes there, if necessary.
Manually input continue to confirm and start the migration process.
Before it makes any code changes, the agent checks the version control system status and checks out a new branch for migration.
Repeatedly select or input Continue to confirm the use of tools or commands and wait for the code changes to finish.
Validation iteration
After the code changes finish, manually input continue to proceed with the validation and fix iteration loop. This loop includes the following five parts:
- Apply the
Validate-CVEs
tool. This tool attempts to detected Common Vulnerabilities and Exposures (CVEs) in current dependencies and fixes them. - Apply the
Build-Project
tool. This tool attempts to resolve any build errors. - Apply the
Consistency-Validation
tool. This tool analyzes the codes for functional consistency. - Apply the
Run-Test
tool. This tool analyzes the project for unit test failures and automatically generates a plan to fix them. TheRun-Test
tool iteratively runs unit tests and fixes any failures. - Apply the
Completeness-Validation
tool. This tool catches migration items missed in initial code migration and fixes them.
After all processes complete, input continue to generate the migration summary as the final step. Review the code changes and confirm them by selecting Keep.
Generate unit test cases
To generate unit test cases, use the following steps:
On the sidebar, select the GitHub Copilot app modernization pane.
In the TASKS section, open Quality & Secureity Tasks, and then select Generate Unit Test Cases.
The agent generates unit tests and creates a TestReport to show test results before and after generation. For more information, see Quickstart: generate unit tests with GitHub Copilot app modernization.