Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)40k · #7261

java-upgrade

Skill này làm gì

Giúp nâng cấp dự án Java của bạn lên phiên bản Java mới hơn (ví dụ từ 11 lên 17). Công cụ hướng dẫn từng bước để bạn sử dụng an toàn các tính năng ngôn ngữ và thư viện mới.

Khi nào nên dùng

  • ✓Khi bạn muốn cập nhật mã Java lên phiên bản mới hơn.
  • ✓Khi bạn muốn hiện đại hóa các tính năng trong dự án Java.
  • ✓Khi bạn muốn áp dụng các tính năng mới của Java như 'records' hoặc 'sealed classes'.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/java-upgrade/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/java-upgrade/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn nâng cấp dự án Java của mình từ 11 lên 17 và sử dụng các tính năng mới.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI kiểm tra dự án đang dùng phiên bản Java nào, rồi hướng dẫn bạn thực hiện các thay đổi cần thiết, từng phiên bản một. Nó gợi ý cập nhật hệ thống build, sau đó giúp đưa các tính năng ngôn ngữ mới vào mã.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Upgrade Guide
Java 11 → 17 references/java-11-to-17.md
Java 17 → 21 references/java-17-to-21.md
Java 21 → 25 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.
Câu hỏi thường gặp

Khác biệt giữa kỹ năng này và plugin 'modernize-java' là gì?

Kỹ năng này cung cấp hướng dẫn từng bước đơn giản hơn. Plugin 'modernize-java' là công cụ mạnh hơn, dùng cho các nâng cấp tự động và phức tạp, và có thể cài đặt riêng.

“Records” và “sealed classes” là gì?

“Records” là cách đơn giản để tạo các lớp chứa dữ liệu. “Sealed classes” cho phép bạn kiểm soát những lớp nào được phép kế thừa một lớp cụ thể.

Tôi có thể bỏ qua một số phiên bản Java không?

Không nên. AI khuyến nghị nâng cấp mỗi lần một phiên bản chính (ví dụ từ 11 lên 17, rồi từ 17 lên 21) để đảm bảo mọi thứ hoạt động đúng.

Chi tiết

Mô tả gốc của tác giả

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-e

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7261
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự