Skip to main content
skill GitHub Copilot official · GitHub

java-upgrade — GitHub Copilot skill: Java upgrade guide

Guides a Java project through a JDK upgrade and helps adopt newer language features. It covers 11 to 17, 17 to 21, and 21 to 25.

Install into GitHub Copilot · Skills CLI (Vercel) All methods and platforms ↓
npx skills add github/awesome-copilot --skill java-upgrade
Open on GitHub

What java-upgrade does

The skill detects the current Java version from pom.xml, build.gradle*, toolchain settings, and CI files. It then loads the guide for the required upgrade instead of all version guides. The workflow updates the build first, moves through one LTS release at a time, and runs builds and tests after each step.

It includes guides for Java 11 to 17, 17 to 21, and 21 to 25. The instructions cover framework checks for Spring Boot, Quarkus, and Jakarta EE, warnings for preview features, and verification with ./mvnw verify or ./gradlew build. OpenRewrite can be used when available, with the generated diff reviewed before merging.

Install it when you want a guided upgrade with small, reviewable changes. For an automated end-to-end transformation, use the separate modernize-java plugin.

What it helps with

  • detect the current and target JDK versions
  • update Maven or Gradle build settings
  • move a project between Java LTS releases
  • check dependencies and deprecation warnings
  • adopt records, sealed classes, or pattern matching gradually

Example prompts for the agent

  • Upgrade this project from Java 17 to Java 21 step by step and run the tests after each stage.
  • Inspect `pom.xml` and the CI files, identify the current Java version, and suggest the upgrade path.
  • After the upgrade, find code that could use records, sealed classes, or pattern matching.

How to install java-upgrade

1Skills CLI (Vercel)

npx skills add github/awesome-copilot --skill java-upgrade

2GitHub CLI

gh skill install github/awesome-copilot java-upgrade

3Manually: put the files in place

.github/skills/java-upgrade/SKILL.md

From the same set554

The whole set →
git-commit official github This skill reviews Git changes, stages related files, and creates Conventional Commits. Use it when you want an agent to make one commit or split work into separate commits. GitHub Copilot 47,165installs excalidraw-diagram-generator official github Turn a plain-language description into an Excalidraw diagram. Useful for mapping processes, system structure, and relationships between entities. GitHub Copilot 31,639installs multi-stage-dockerfile official github This skill guides GitHub Copilot in writing multi-stage Dockerfiles for different languages and frameworks. Use it when the final runtime image should contain fewer build dependencies. GitHub Copilot 29,688installs documentation-writer official github Skill that turns the agent into a technical writer following the Diátaxis framework: tutorials, how-to guides, reference, and explanation. Proposes structure before writing. GitHub Copilot 27,757installs prd official github Turns a feature idea into a structured PRD with user stories, technical requirements, and risks. Use it when planning a software feature or an AI-powered one. GitHub Copilot 24,035installs refactor official github This skill reshapes existing code without changing its external behavior. Use it for gradual cleanup of large functions, duplication, weak types, and code smells. GitHub Copilot 22,321installs java-springboot official github Gives GitHub Copilot Spring Boot development practices, from project layout to tests and security. Use it when writing or reviewing Java application code. GitHub Copilot 21,272installs create-readme official github This skill reviews a project and creates a structured README.md. Use it when the repository needs clear documentation based on its actual files and code. GitHub Copilot 19,081installs

Similar

view-refactor official OpenAI This skill restructures macOS SwiftUI views and scenes. Use it when a large view needs splitting or AppKit boundaries have grown too broad. CX Codex GP ChatGPT 52installs canva-translate-design official Canva Pty Ltd. Translates every text element in a Canva design and creates a separate copy. Use it to localize layouts without editing each text box by hand. CX Codex GP ChatGPT 25installs kql microsoft This skill helps agents write, debug, and review KQL queries. Use it for ADX, Log Analytics, Sentinel, and other Microsoft data services. Claude Code GitHub Copilot 58installs typescript-data-visualization-engineering official OpenAI Guides typed data visualization architecture in TypeScript, covering data contracts, state boundaries, and renderer selection from D3 to WebGL. CX Codex GP ChatGPT 9installs migrate-to-shoehorn Matt Pocock Replaces as type assertions in tests with helpers from @total-typescript/shoehorn. Use it when tests need partial objects or deliberately invalid data. Claude Code 475,388installs write-swift emilkowalski This skill guides Swift coding, reviews, and migrations using the language’s current practices. Use it to investigate concurrency errors, hangs, data races, or retain cycles. Claude Code CX Codex Cursor +1 117,500installs megacave JuliusBrussee Switches agent responses to Classical Chinese (wenyan) to reduce terminal output. Activated via /megacave or /caveman wenyan. Claude Code CX Codex Cursor +1 24,400installs find-docs upstash Pulls up-to-date documentation, API references and code examples for any library through the Context7 CLI. Useful when the model's training data lags behind the API. Claude Code CX Codex Cursor +1 9,400installs

Questions about java-upgrade

How do I install java-upgrade in GitHub Copilot?

Run npx skills add github/awesome-copilot --skill java-upgrade or gh skill install github/awesome-copilot java-upgrade. The skill file is placed at .github/skills/java-upgrade/SKILL.md.

What does java-upgrade do?

It identifies the Java version used by the build, selects the matching migration guide, and walks through the upgrade in stages. It also helps adopt newer Java features and verify the build with tests.

Can java-upgrade handle Java 21 to Java 25?

Yes. It uses the dedicated guide at references/java-21-to-25.md. Check the target version and framework compatibility before changing the build.

Source text

SKILL.md · MIT
---
name: java-upgrade
description: 'Upgrade a Java project to a newer JDK (11 to 17, 17 to 21, 21 to 25) and adopt the new language and library features. Detects the current Java version from the build files, then loads only the matching per-version guide. Use when the user asks to upgrade Java, modernize Java code, or adopt records, sealed classes, pattern matching, virtual threads or other new Java features. For automated end-to-end upgrades see the modernize-java plugin.'
---

# Java Upgrade

Help upgrade a Java project step by step and adopt new language features safely.

## Need a more powerful, automated upgrade?

The Microsoft plugin [`modernize-java`](https://github.com/microsoft/modernize-java) ("GitHub Copilot modernization - Java Upgrade CLI Plugin", also listed in this repository's `plugins/external.json`) upgrades Java applications from the command line. It can:

- analyze the project, assess dependencies and generate a customizable upgrade plan you can review and edit;
- execute the plan to automatically transform the codebase;
- fix build issues and resolve migration errors during the upgrade, running test validations;
- validate the application against known CVEs after the upgrade;
- output a detailed summary (file changes, updated dependencies, test results, remaining issues) suitable for PRs or CI logs.

This skill provides lightweight, step-by-step guidance and works without the plugin; the plugin is the more powerful option for large or multi-step upgrades. It is a separate Microsoft plugin, not part of this repository's skills. To try it (see the [plugin README](https://github.com/microsoft/modernize-java) for the recommended model):

```bash
npm install -g @github/copilot
copilot plugin marketplace add microsoft/modernize-java
copilot plugin install modernize-java@modernize-java
copilot --agent modernize-java:modernize-java
```

## Workflow

1. **Detect the current and target versions.** Read `pom.xml` (`maven.compiler.release`, `java.version`, toolchains), `build.gradle*` (`java.toolchain`, `sourceCompatibility`) and CI files. Never assume a target: ask the user if it is not stated.
2. **Upgrade one LTS at a time** (11 → 17 → 21 → 25). Build and run the tests after each step.
3. **Load only the guide you need** from the table below. Do not load all of them.
4. **Update the build first** (compiler release, plugins, dependencies that need newer versions), then adopt language features incrementally in small, reviewable changes.
5. **Verify**: `./mvnw verify` or `./gradlew build`, and fix deprecation and removal warnings before adopting new features.
6. **Automate and check upstream.** Use OpenRewrite when available (for example `org.openrewrite.java.migrate.UpgradeToJava21`) and always fetch the version-specific official guide before editing; review the generated diff.

## Upstream sources (read before upgrading)

Fetch the page for the target version; prefer it over this skill when they conflict. Full list with build-tool and agent compatibility pages: [references/upstream-sources.md](references/upstream-sources.md).

- OpenJDK release page: <https://openjdk.org/projects/jdk/21/> (change the number) and JEP index <https://openjdk.org/jeps/0>
- Oracle migration guide: <https://docs.oracle.com/en/java/javase/21/migrate/getting-started.html>
- Oracle release notes: <https://www.oracle.com/java/technologies/javase/21-relnote-issues.html>
- `jdeprscan` / `jdeps`: <https://docs.oracle.com/en/java/javase/21/docs/specs/man/jdeprscan.html>, <https://docs.oracle.com/en/java/javase/21/docs/specs/man/jdeps.html>
- Gradle compatibility matrix: <https://docs.gradle.org/current/userguide/compatibility.html>
- OpenRewrite: <https://docs.openrewrite.org/recipes/java/migrate/upgradetojava21>

## Per-version guides

| Upgrade | Guide |
|---|---|
| Java 11 → 17 | [references/java-11-to-17.md](references/java-11-to-17.md) |
| Java 17 → 21 | [references/java-17-to-21.md](references/java-17-to-21.md) |
| Java 21 → 25 | [references/java-21-to-25.md](references/java-21-to-25.md) |

## Rules

- Prefer behavior-preserving refactorings; do not change public APIs unless asked.
- Detect the project's frameworks (Spring Boot, Quarkus, Jakarta EE) and check their minimum supported Java version before raising the target.
- Do not adopt preview features unless the user opts in and the build enables them explicitly.
- For `javax.*` to `jakarta.*` namespace changes, use the `javax-to-jakarta-migration` skill if it is installed (`gh skills install github/awesome-copilot javax-to-jakarta-migration`); otherwise do the migration inline: update imports, `META-INF` service files and XML descriptors, and bump dependencies to Jakarta EE 9+ equivalents.
- If the `modernize-java` plugin is installed and the user wants an automated upgrade, defer to it and use this skill for the per-version guides and the `javax` to `jakarta` safeguards.

© github · MIT · github/awesome-copilot

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor