Edit

Share via


Quickstart: create and apply your own tasks for GitHub Copilot App Modernization for Java

This quickstart shows you how to create and apply your own tasks 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 tasks come in. A custom task is generated by analyzing code commits from already-migrated code. The task 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 task to migrate a Java project to Azure:


Prerequisites

Create a custom task

Use the following steps to create a custom task:

  1. Clone the Java migration copilot samples repository.

  2. In Visual Studio Code, open the rabbitmq-sender project folder in the samples repository. Then, check out the project to the source branch.

  3. In the Activity sidebar, open the App Modernization for Java extension pane and then, in the Tasks - Custom section, select Create Custom Task.

    Screenshot of Visual Studio Code that shows the button for Create Custom Task.

  4. In the pop-up dialog box, select Create new task.

    Screenshot of Visual Studio Code that shows the Create new task option.

  5. Type migrate rabbitmq to service bus to search for the commit that migrates RabbitMQ. Select the corresponding commit and then select OK.

    Screenshot of the Visual Studio Code dialog box with the heading Select commits you want to save.

  6. Select any uncommitted changes from Working tree if they exist, then select OK.

  7. 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 task. Then select OK. The file you selected is processed locally.

    Screenshot of Visual Studio Code that shows the Describe changes using local files dialog box.

  8. A default task name is generated. Name it custom task migrate rabbitmq, then press Enter to confirm. A task description is generated. Press Enter to confirm.

  9. Now, the custom task for migrating rabbitmq is generated and shows in the Tasks - Custom section of the App Modernization for Java pane.

    Screenshot of Visual Studio Code that shows the Tasks section with the rabbitmq task showing.

Apply the custom task

Use the following steps to apply the custom task:

  1. Check out the project to the main branch. Find the custom task in the Tasks section of App Modernization for Java pane. Run this task by selecting Run Task.

    Screenshot of Visual Studio Code that shows the Tasks section with the Run task button indicated by a tooltip.

    After you select the task, the Copilot chat window with Agent Mode opens automatically.

  2. 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.

  3. After each step, manually input continue to confirm and proceed.

  4. Wait for the code changes to be generated.

  5. 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.

  6. After the Build-Fix tool begins, select Continue to proceed and show progress.

  7. After the tool is finished, review the code changes and confirm them by selecting Keep.

See also

Predefined tasks for GitHub Copilot App Modernization for Java