GitHub Copilot app modernization - upgrade for Java
GitHub Copilot app modernization - upgrade for Java helps you upgrade your Java applications. It's an extension for Visual Studio Code which can help:
- Analyze your project, assess your dependencies and propose an upgrade plan
- Execute the plan to transform your project
- Automatically fix issues during the progress
- Report all details including commits, logs and output
- Show a summary including file changes, updated dependencies and commits in the working branch when update is finished
License
This extension is licensed under GitHub Copilot Product Specifc Terms.
Prerequisites
JDK
JDKs are required to perform the upgrade. Both the source version and the target version of JDKs are needed. For example, to upgrade from Java 8 to Java 21, both JDK 8 and JDK 21 need to be installed.
To install JDK, please follow this link.
Maven
Maven is required. Maven wrapper is also supported if your project has one. During the upgrade, certain Maven plugins may be used, such as rewrite-maven-plugin, which will be downloaded to your local Maven repository like other Maven plugins.
To install Maven, please follow the instructions.
Gradle
To upgrade the gradle project, there are some limitations:
- Only supports Gradle version 5+
- Only supports Gradle wrapper
- Kotlin script is not supported
GitHub Copilot
You will need an active GitHub Copilot license. You can learn more here.
Installation
- Install the latest Insiders version of Visual Studio Code. Please make sure it is the Insiders version.
- Make sure you are on the latest Visual Studio Code, open the command palette via F1 or Ctrl/Cmd + Shift + P and run the command "Code: Check for Updates..."
- Download the .VSIX file for the bug bash
- In Visual Studio Code, open the command pallete via F1 or Ctrl/Cmd + Shift + P, and run the command "Extensions: Install from VSIX...", and then navigate to your downloaded VSIX and install it.
- Restart Visual Studio Code.
How to use
Starting the flow
- Open Visual Studio Code
- Open GitHub Copilot Chat and select "Agent Mode"
- Type a prompt such as "Upgrade project to Java 21 and Spring Boot 3.2"
- GitHub Copilot will then ask user to confirm on "Run
Generate a plan
".. Click "Continue" to proceed.

Reviewing the plan
- After clicking "Continue", an upgrade will be generated and the user will be presented the preview of a markdown file
plan.md
.
- In this phase, the user is encouraged to review this file and edit the file if necessary. The goal is make sure the source and target JDK versions are correct, the target framework versions are correct as well as the third-party library versions. If nothing needs to be adjusted, simply skip this step.
- After adjusting the plan as needed, click "Continue" to proceed.

Applying code changes
Now the tool will enter the phase where it applies the code transformation to the project. First it will uses an Open-source tool called OpenRewrite to make some code changes based on some recipes. Then it will use AI to address the remaining issues in a dynamic build/fix loop. During this process, the user can see the progress in the editor area of VS Code via the progress.md
markdown file at any time.
- Click on "Continue" when GitHub Copilot says "Run
Upgrade Java code using OpenRewrite
".
- Click on "Continue" when GitHub Copilot says "Run
Build project and fix errors
".
- During this phase, GitHub Copilot will continue to fix errors and build project, until all issues are resolved. If you see "Build Project" is successful, that means this step is completed and we are moving to the next phase.

Running CVE vulnerability and code behavior inconsistency checks
Sometimes, Copilot might apply code changes and upgrade to third-party library versions that has CVE issues, or cause code behavior change. We need to run an extra step to check for these issues.
- After the previous steps, click on "Continue" when GitHub Copilot says "Run
Validate if any modified dependencies has any known CVEs
".
- GitHub Copilot might find several CVEs and if so, GitHub Copilot Agent Mode will try to fix these issues directly. The user can view the diff within VS Code and decide whether to keep these changes.

- When the CVE check is completed, we will move on to the next check. Click on "Continue" when GitHub Copilot says "Run
Validate code behavior consistency
".
- Similarly, if any issues are found, GitHub Copilot Agent Mode will again attempt to resolve the issues. User can decide to keep changes or discard them.
- After the checks are completed, GitHub Copilot will build the project again and make sure everything is okay. This includes running the previous checks one more time.
- If the final validation finds minor issues that Copilot thinks that do not require fixes at this time, then the upgrade is done! Otherwise, we will go back to address them.

Viewing the summary
- When the upgrade is completed, we will be prompted to see the summary. You can view the project information, updated dependencies, summarizied code changes, etc. This file can directly be found in the folder as
summary.md
.
Congrats, you just finished your first Java upgrade!

Limitations
Please note that we currently only support JDK upgrade within 8/11/17/21, and Spring Boot versions to 2.7 and 3.2
FAQ
See FAQ
Developer Guided Fixes
When there are errors that Copilot is not able to fix, Copilot will ask you for help. Please guide Copilot by:
- Make code changes to fix at least 1 of the errors.
- Save the changes and click "Try Again".
- Copilot will learn from the changes and try to fix the rest of the errors.
Telemetry
VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry
setting to false
. Learn more in our FAQ.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.