Sling 父级 POM 版本升级
update-sling-parent-pom
当用户要求升级其项目中的 Sling 父级 POM 版本时使用。
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-30
- Stars
- ★ 0
- Forks
- 2
01 前言 Front Matter
- name
- update-sling-parent-pom
- description
- Use when the user asks to upgrade the Sling parent POM version in their project
02 资源文件 16
- 参考文档references/bundle-parent.md2.5 KB
- 参考文档references/deps-scope.md208 B
- 参考文档references/felix-http-jetty-jdk21.md2.6 KB
- 参考文档references/git-blame-ignore-revs.md2.3 KB
- 参考文档references/mockito-java17.md257 B
- 参考文档references/osgi-annotations.md8.0 KB
- 参考文档references/osgi-deps.md994 B
- 参考文档references/osgi-r6.md415 B
- 参考文档references/pax-exam-timeouts.md2.2 KB
- 参考文档references/rat-disable.md295 B
- 参考文档references/rat-enable.md199 B
- 参考文档references/readd-scr-annotations.md410 B
- 参考文档references/servlet-3.md190 B
- 参考文档references/slf4j2-paxexam-it.md4.5 KB
- 参考文档references/sling-java-version.md1.2 KB
- 参考文档references/timestamp.md184 B
03 SKILL.md 正文
Updating the Sling Parent POM
When to use
Use when the user asks to upgrade the Sling parent POM version in their project.
Instructions
- record the current Java and Maven environment with
java -versionandmvn -version - run a baseline
mvn clean verifyif the current checkout is expected to support the current Java version- if the baseline build fails only because the current parent POM or project setup requires an older Java version, document that and continue
- assume the unchanged project would pass with its required Java version; do not switch to version-specific Maven wrappers just to prove the baseline unless the user explicitly asks
- if the baseline fails for a reason unrelated to the Java version, abort execution and inform the user of the root cause before changing the parent POM
- check if any known workarounds exist, but do not remove them yet
- if other repos in the same workspace/org use the same parent artifact and test patterns (e.g. pax-exam quickstart ITs), check whether one has already been migrated to the target parent version — its pinned test/IT dependency versions are a validated reference point and can save significant troubleshooting
- identify the current version of the Sling parent POM in the user's project
- determine the latest available Sling parent POM version for the applicable parent artifact
- target the latest available version, not merely the next increment
- check
https://cwiki.apache.org/confluence/spaces/SLING/pages/284790344/Update+to+Parent+60for additional instructions. Follow any steps it documents that are not already covered by this skill's reference files - update the parent POM version
- run
mvn validatewith the current Java version before running a full build- if
mvn validatefails, fix any POM syntax issues first - if the new parent POM no longer manages some plugin versions, add explicit plugin versions for the affected plugins
- if the new parent POM no longer manages some dependency versions, add explicit dependency versions for the affected dependencies
- do not continue to
clean verifyuntilmvn validatesucceeds
- if
- run a full
mvn clean verifybuild with the current Java version- the goal is for the upgraded project to build successfully with the current Java version
- if the build fails because Spotless formatting checks were introduced or changed by the new parent POM, run
mvn spotless:apply, review the resulting formatting changes, and rerunmvn clean verify
- if the project's CI runs a Java version matrix (check the Jenkinsfile or CI config; commonly includes versions newer than the one just used to verify), also verify with the highest JDK version in that matrix using the appropriate
mvnNNwrapper (e.g.mvn21 clean verifyfor JDK 21 — see skills/README.md § Invoking Apache Maven with different Java versions) before considering the upgrade complete — some failures (e.g. felix-http-jetty-jdk21.md) only reproduce on newer JDKs and will not show up when verifying with the minimum required version alone - apply additional verification steps as needed if the specific version requires it
- if workarounds were present before updating the parent POM version, check if they can be removed. If they are needed add them back
Do not touch the git repository state - no staging/unstaging, no commits, no pushes.
If the user separately commits and pushes the changes (e.g. to an open PR) and a CI build fails, fetch the raw log (e.g. a Jenkins job's consoleText endpoint) rather than a JS-rendered log viewer — rendered pipeline-explorer pages often don't expose the actual error text to a fetch tool. A "tests passed" summary alongside an overall build failure means the real failure is in a later stage (verify/IT/checks) — check the full log rather than stopping at the test summary.
Unsupported versions
The following historical versions are not supported and must be skipped:
- 42
- 50
Additional fixes
Use the following reference files when a matching migration issue or build failure appears.
- rat-disable: rat-disable.md
- osgi-r6: osgi-r6.md
- servlet-3: servlet-3.md
- osgi-annotations: osgi-annotations.md
- bundle-parent: bundle-parent.md
- timestamp: timestamp.md
- mockito-java17: mockito-java17.md
- readd-scr-annotations: readd-scr-annotations.md
- osgi-deps: osgi-deps.md
- deps-scope: deps-scope.md
- sling-java-version: sling-java-version.md
- slf4j2-paxexam-it: slf4j2-paxexam-it.md
- felix-http-jetty-jdk21: felix-http-jetty-jdk21.md
- pax-exam-timeouts: pax-exam-timeouts.md
- git-blame-ignore-revs: git-blame-ignore-revs.md
Workarounds
- rat-enable: rat-enable.md
04 同仓库更多 Skills
Apache Sling 项目自动化发布
sling-release
使用 Maven 和 sling-cli Docker 工具端到端自动化发布 Apache Sling 项目。当用户想要发布 Sling 项目、启动发布流程、执行 Apache Sling 发布流程的任一步骤,或询问 Sling 模块的发布/投票/晋升时使用。
OSGi SCR 注解迁移
osgi-scr-migrator
将基于 OSGi 的 Java 项目从已弃用的 Felix SCR 注解迁移到官方 OSGi R6/R7 Component 注解。适用于迁移使用 org.apache.felix.scr.annotations 中 @Component、@Service、@Reference、@Property 的旧版 OSGi bundle,将其迁移到 org.osgi.service.component.annotations。同时处理 Java 源代码转换和 Maven POM 更新(移除 maven-scr-plugin、更新依赖)。还支持 Sling 特有的注解,如 @SlingServlet 和 @SlingFilter。具备属性迁移、元类型配置生成、构造器注入优化、验证和全面报告的全流程自动化特性。在完成基础迁移后,提供可选的第 7 步,使用构造器注入对不可变依赖进行代码优化。