|
| 1 | +--- |
| 2 | +title: Modernizing Java applications with GitHub Copilot |
| 3 | +shortTitle: Modernize Java applications |
| 4 | +intro: '{% data variables.product.prodname_copilot %} can help modernize and migrate Java applications by assessing your codebase, identifying upgrade paths, and automating remediation and containerization tasks.' |
| 5 | +versions: |
| 6 | + feature: copilot |
| 7 | +contentType: tutorials |
| 8 | +category: |
| 9 | + - Modernize applications |
| 10 | + - Author and optimize with Copilot |
| 11 | +--- |
| 12 | + |
| 13 | +<!-- expires 2026-10-31 --> |
| 14 | + |
| 15 | +<!-- When this expires, check with the stakeholder for release #18998 on whether or not the content is still needed --> |
| 16 | + |
| 17 | +The {% data variables.product.prodname_copilot %} app modernization extension in {% data variables.product.prodname_vscode %} automates Java upgrades by identifying outdated frameworks, deprecated APIs, and upgrade blockers. {% data variables.copilot.copilot_coding_agent %} applies code changes, updates build files, and resolves build and CVE issues for you. <!-- markdownlint-disable-line GHD046 --> |
| 18 | + |
| 19 | +The recommendations and reporting produced by the extension can help your teams adopt new technologies quickly and reduce technical debt. {% data variables.product.prodname_copilot_short %} guides you through upgrades with actionable steps and summaries, accelerating and securing your migrations while reducing manual effort. |
| 20 | + |
| 21 | +For extension capabilities, setup, and user interface instructions, see [The GitHub Copilot app modernization documentation](https://learn.microsoft.com/en-us/azure/developer/github-copilot-app-modernization/) in the Microsoft documentation. |
| 22 | + |
| 23 | +## Modernization framework |
| 24 | + |
| 25 | +When you start an agent session using the [Java upgrade extension](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-upgrade), the extension will help you modernize your Java application using the following framework. |
| 26 | + |
| 27 | +* **Perform assessment tasks**. The extension can analyze code, configuration, and dependencies, providing an assessment of your application's current state. |
| 28 | +* **Create a customizable modernization plan**. Based on the assessment, the extension can suggest a modernization path, including necessary framework and library updates. |
| 29 | +* **Early identification of issues**. The extension identifies dependencies, outdated libraries and language features, and potential migration issues. The extension provides actionable strategies to remediate problems. |
| 30 | +* **Customize your plan**. Edit the modernization plan to your application's specific needs, such as incorporating organizational standards and practices, excluding certain components, or prioritizing specific features or design patterns. |
| 31 | +* **Implement your plan**. The extension can assist in applying code changes, updating build files, refactoring deprecated APIs, and resolving build and syntax issues. The extension will automatically fix build errors and perform test validations after each step to ensure stability and error-free changes. <!-- markdownlint-disable-line GHD046 --> |
| 32 | +* **Review your changes**. The extension can produce a detailed upgrade report, summarizing the changes applied, and listing any unaddressed issues and remaining steps for your modernization. |
| 33 | +* **Generate unit tests**. The extension automatically evaluates existing tests, and generates new test files and adds them to the workspace. A report is produced summarizing the pre- and post-generation test results. |
| 34 | +* **Containerize your application**. The extension can automatically generate Dockerfiles, build images, and validate everything for your modernized application to run within the container services such as Azure Kubernetes Service (AKS), Azure Container Apps (ACA), and AKS Automatic, enabling easier deployment and scalability. |
| 35 | +* **Prepare for deployment**. The extension can help you prepare your application for containerization and deployment, by generating deployment artifacts such as scripts and configurations. |
| 36 | +* **Automate deployment to Azure**. The extension can help you deploy or provision your modernized application to Azure, generating necessary artifacts and Azure resources, and performing execution steps. |
| 37 | + |
| 38 | +You can improve your team's understanding of the application codebase, and save time and effort by using {% data variables.product.prodname_copilot_short %} to help with complex modernization tasks such as: |
| 39 | + |
| 40 | +* Reverse engineering and code transformation |
| 41 | +* Vulnerability and dependency analysis, and code behavior checks and remediation |
| 42 | +* Automated generation of assets, documentation, and upgrade reports |
| 43 | +* Test generation and evaluation |
| 44 | +* Deployment automation |
| 45 | + |
| 46 | +## Modernization workflow overview |
| 47 | + |
| 48 | +In this example, we'll walk through the high-level steps to modernize a Java application using the {% data variables.product.prodname_copilot %} app modernization extension in {% data variables.product.prodname_vscode %}. |
| 49 | + |
| 50 | +For detailed prerequisites and instructions, see [Quickstart: upgrade a Java project with {% data variables.product.prodname_copilot %} app modernization](https://learn.microsoft.com/en-us/java/upgrade/quickstart-upgrade) in the Microsoft documentation. |
| 51 | + |
| 52 | +> [!NOTE] |
| 53 | +> During the modernization workflow, you may frequently be prompted by {% data variables.copilot.copilot_coding_agent %} for confirmation before it performs specific actions. |
| 54 | +
|
| 55 | +### 1. Open your Java project |
| 56 | + |
| 57 | +Use {% data variables.product.prodname_vscode_shortname %} to open your project folder. |
| 58 | + |
| 59 | +#### Suggested actions |
| 60 | + |
| 61 | +* Ensure your project builds successfully before proceeding. |
| 62 | +* If you encounter build issues, you can use {% data variables.product.prodname_copilot_short %} to help resolve them before starting the modernization process. |
| 63 | + |
| 64 | +### 2. Start a modernization workspace |
| 65 | + |
| 66 | +Launch {% data variables.copilot.copilot_chat_short %} and start a new session in agent mode. Choose **{% data variables.product.prodname_copilot %} app modernization – upgrade for Java** from the available tools. |
| 67 | + |
| 68 | +### 3. Analyze your project for upgrade opportunities |
| 69 | + |
| 70 | +{% data variables.product.prodname_copilot_short %} will scan your codebase. The analysis includes: |
| 71 | + |
| 72 | +* Detection of outdated frameworks (for example, Spring Boot, Jakarta EE, Java SE versions). |
| 73 | +* Identification of deprecated APIs and obsolete patterns. <!-- markdownlint-disable-line GHD046 --> |
| 74 | +* Suggestions for upgrade opportunities. |
| 75 | + |
| 76 | +You can review the findings and a structured upgrade plan in the editor, which will display: |
| 77 | + |
| 78 | +* Current and recommended versions for frameworks and dependencies. |
| 79 | +* Code locations requiring migration or refactoring. |
| 80 | +* Upgrade blockers or incompatible dependencies. |
| 81 | + |
| 82 | +#### Suggested actions |
| 83 | + |
| 84 | +* Review and customize the modernization plan before proceeding with the upgrade. |
| 85 | + |
| 86 | +### 4. Apply {% data variables.product.prodname_copilot_short %} upgrade recommendations |
| 87 | + |
| 88 | +Use {% data variables.product.prodname_copilot_short %} to apply or review code changes, update build files, and refactor APIs. |
| 89 | + |
| 90 | +If build errors are found, {% data variables.product.prodname_copilot_short %} can enter a fix-and-test loop until the project compiles cleanly. |
| 91 | + |
| 92 | +{% data variables.copilot.copilot_coding_agent %} automated changes can include: |
| 93 | + |
| 94 | +* Updating `pom.xml` or `build.gradle` files for new dependency versions. |
| 95 | +* Generating pull requests or committing changes directly. |
| 96 | +* Refactoring code for API changes. For example, migrating from `javax.*` to `jakarta.*` namespaces. |
| 97 | +* Suggesting or applying code transformations to address breaking changes. |
| 98 | + |
| 99 | +{% data variables.product.prodname_copilot_short %} will iterate and continue to fix errors until the project builds successfully and there are no more issues that require fixing. It's possible that minor issues that don't require immediate fixes may remain. These will not prevent the upgrade from completing. |
| 100 | + |
| 101 | +#### Suggested actions |
| 102 | + |
| 103 | +* Review all code changes in your diff editor before accepting. |
| 104 | +* Use {% data variables.product.prodname_copilot_short %} to further explain and document code changes. |
| 105 | +* When the extension prompts you to, accept the options to check modified dependencies for known CVEs, and to validate code behavior for consistency. |
| 106 | +* Review any issues remaining and evaluate their importance. |
| 107 | + |
| 108 | +### 5. View the upgrade report and suggested next steps |
| 109 | + |
| 110 | +After the upgrade process is complete, {% data variables.product.prodname_copilot_short %} will generate a summary upgrade report that includes: |
| 111 | + |
| 112 | +* Project information. |
| 113 | +* Lines of code changed. |
| 114 | +* Updated dependencies. |
| 115 | +* Summarized code changes. |
| 116 | +* Fixed CVE security and code inconsistency issues, if any. |
| 117 | +* Unaddressed minor CVE issues. |
| 118 | + |
| 119 | +#### Suggested actions |
| 120 | + |
| 121 | +* Review the report to understand the changes made. |
| 122 | +* Follow any suggested next steps to finalize your modernization. |
| 123 | + |
| 124 | +### Completing the modernization |
| 125 | + |
| 126 | +Further work to support your modernization may include: |
| 127 | + |
| 128 | +* **Checking** the initial modernization and code changes thoroughly. Ensure your company's coding standards and best practices are met. |
| 129 | +* **Reviewing** modified code closely. For example, check that the generated code fits the purpose and architecture of your project. For more suggestions, see [AUTOTITLE](/copilot/tutorials/review-ai-generated-code). |
| 130 | +* **Bug fixing**. Check specific content for subtle errors, and use your own debugging and linting tools to evaluate new content. |
| 131 | +* **Writing tests** and identifying gaps in testing for the upgraded project. |
| 132 | +* **Cleaning up** the project by removing any files that are no longer needed. |
| 133 | +* **Refactoring** the code in the new language. The modernization process may have resulted in a project whose architecture was based on that of your original project, but that is no longer the ideal or optimum solution for your needs. You may now want to refactor the code to make best use of features of the language and the framework used. |
| 134 | +* **Updating documentation**. Your project information and contributing files may now be out of date and need to be rewritten. |
| 135 | +* **Containerization**. Update your application code, generate containerization files like Dockerfiles, and build the image to test the validity. If needed, {% data variables.product.prodname_copilot_short %} can perform these containerization tasks, and also create a comprehensive plan detailing the next steps. |
| 136 | +* **Deploying** the modernized application to your target environments, including cloud platforms such as Microsoft Azure. |
| 137 | + |
| 138 | +<!-- end expires 2026-10-31 --> |
0 commit comments