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 create and apply your own formulas when you use GitHub Copilot App Modernization for Java.
In code development, enterprises often have different processes and controls to adhere to their organizational policies and business needs. This area is where custom formulas come in. A custom formula is generated by analyzing code commits from already-migrated code. The formula then guides Copilot to remediate code, following the pattern established by the already-migrated code.
The following video demonstrates using GitHub Copilot App Modernization for Java to create and apply your own custom formula to migrate a Java project to Azure:
Prerequisites
A GitHub account with GitHub Copilot enabled. All plans are supported, including the Free plan.
The latest version of Visual Studio Code. Must be version 1.101 or later.
The latest version of the GitHub Copilot extension in Visual Studio Code.
GitHub Copilot App Modernization extension pack. For install instructions, see Quickstart: assess and migrate a Java project using GitHub Copilot App Modernization for Java.
This extension pack bundles the following two extensions:
App Modernization doesn't require Java in your local environment. However, to build your project successfully, install the correct version of Java and Maven. We recommend the Microsoft Build of OpenJDK and Maven.
AppCAT. This tool is required for the app assessment feature.
Create a custom formula
Use the following steps to create a custom formula:
Clone the Java migration copilot samples repository.
In Visual Studio Code, open the rabbitmq-sender project folder in the samples repository. Then, check out the project to the expected branch.
In the Activity sidebar, open the App Modernization for Java extension pane and then, in the Formulas - Custom section, select Create Custom Formula.
In the pop-up dialog box, select Create new formula.
Type migrate rabbitmq to expected to search for the commit that migrates RabbitMQ. Select the corresponding commit and then select OK.
Select any uncommitted changes from Working tree if they exist, then select OK.
If you want to import the commits from a file, choose Select Files in the next pop-up dialog box. This option enables you to select files that contain the commit history you want to use for the custom formula. Then select OK. The file you selected is processed locally.
A default formula name is generated. Name it custom formula migrate rabbitmq, then press Enter to confirm. A formula description is generated. Press Enter to confirm.
Now, the custom formula for migrating
rabbitmq
is generated and shows in the Formulas - Custom section of the App Modernization for Java pane.
Apply the custom formula
Use the following steps to apply the custom formula:
Check out the project to the main branch. Find the custom formula in the Formulas section of App Modernization for Java pane. Run this formula by selecting Run Formula.
After you select the formula, the Copilot chat window with Agent Mode opens automatically.
Select Continue repeatedly to confirm each tool action in the Copilot Chat window. The Copilot Agent uses various tools to facilitate application modernization. Each tool's usage requires confirmation by selecting Continue.
After each step, manually input continue to confirm and proceed.
Wait for the code changes to be generated.
When you're prompted to run the Java Application Build-Fix tool, select Continue to build the project and fix errors. This tool attempts to resolve any build errors in up to 10 iterations.
After the Build-Fix tool begins, select Continue to proceed and show progress.
After the tool is finished, review the code changes and confirm them by selecting Keep.
See also
Predefined formulas for GitHub Copilot App Modernization for Java