跳到正文
cccskills
免费在 GitHub 公开

java-upgrade

Upgrade Java projects through versions 11, 17, 21, and 25 with step-by-step guidance. Identify current build settings, update compatible dependencies, verify each stage with tests, and gradually adopt newer language features while preserving behavior.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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.

查看安装方法

适用场景

  • Upgrading Java one long-term support version at a time
  • Updating Maven or Gradle build settings
  • Gradually adopting records or virtual threads
  • Resolving deprecated API warnings during migration

包含的文件(5)

  • SKILL.md4.8 KB
  • references/java-11-to-17.md21.5 KB
  • references/java-17-to-21.md13.7 KB
  • references/java-21-to-25.md9.7 KB
  • references/upstream-sources.md2.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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 ("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 for the recommended model):

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.

Per-version guides

UpgradeGuide
Java 11 → 17references/java-11-to-17.md
Java 17 → 21references/java-17-to-21.md
Java 21 → 25references/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.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Map an existing codebase into seven documents covering its technology, structure, architecture, conventions, integrations, tests, and concerns. Link findings to file evidence, mark unknowns, and highlight differences between stated plans and the actual implementation.

中文简介正在准备中。当前显示英语简介。

  • Get oriented in an unfamiliar codebase
  • Prepare documentation for a project handover
  • Compare documented architecture with implementation
github/awesome-copilot4万2026年10月17日 更新

Assess a repository’s readiness for AI agents with AgentRC and generate a standalone HTML dashboard. Review scores across nine areas, see prioritized improvements, and optionally apply scoring policies tailored to an organization.

中文简介正在准备中。当前显示英语简介。

  • Assessing a repository’s readiness for AI agents
  • Prioritizing improvements from assessment results
  • Reviewing scores under an organization’s own policy
github/awesome-copilot4万2026年10月17日 更新

Generate coding agent instruction files from a project's actual code using AgentRC. Capture detected languages, frameworks, and conventions in one shared file or split rules by topic and project area, with a preview before writing.

中文简介正在准备中。当前显示英语简介。

  • Create project instructions for VS Code Copilot
  • Refresh agent rules after project changes
  • Split monorepo instructions by project area
github/awesome-copilot4万2026年10月17日 更新

Customize AgentRC readiness assessments to match team or organization standards. Choose or create policies that adjust check importance, disable irrelevant checks, set pass thresholds, and define requirements for automated checks in CI workflows.

中文简介正在准备中。当前显示英语简介。

  • Set shared readiness standards across an organization
  • Focus assessments on AI tooling
  • Adjust the importance of individual checks
github/awesome-copilot4万2026年10月17日 更新

Analyze supplied ad performance data to identify wasted spend, strong campaigns, and next tests. Compare channels, assess whether test differences are meaningful, and produce budget reallocation recommendations with a prioritized action plan.

中文简介正在准备中。当前显示英语简介。

  • Identify ads and keywords to pause
  • Find campaigns and audiences worth scaling
  • Assess whether A/B test results are meaningful
github/awesome-copilot4万2026年10月17日 更新

Turn code files into learning resources by adding comments that explain syntax, programming concepts, and design choices. Adjust explanation depth and repetition to the reader’s knowledge while preserving file structure, encoding, and syntax.

中文简介正在准备中。当前显示英语简介。

  • Add beginner-friendly explanations to existing code
  • Document the reasoning behind syntax and design choices
  • Adjust comment depth for readers with different experience
github/awesome-copilot4万2026年10月17日 更新

查看 github 的全部技能

报告此技能的问题