Loading...
Loading...
Spring Boot Starter 开发规范(组织无关)。标准 POM 结构(元素顺序铁律、properties 三段式分类+自然排序、licenses/scm/developers 元数据三段、完整 build/profiles)、十分支版本矩阵(2.3.x~4.1.x ↔ Spring Boot 2.3.12~4.1.0 ↔ JDK 8/17/21)、十 tag 发布工作流(tag → Maven Central → SNAPSHOT 月度滚动)、JDK 兼容规则、JaCoCo 90% 覆盖率门禁。 纠正 LLM:properties 不分类不排序、漏 licenses/scm/developers 导致 Central 发布被拒、java.version 写 1.8 触发编译失败、surefire argLine 丢 ${argLine} 导致 JaCoCo 失效、把 okhttp 等通用库当默认依赖复制。 触发词:starter 开发、pom 标准化、分支版本矩阵、tag 发布、版本滚动、多 Spring Boot 版本适配、新建 xxx-spring-boot-starter。
npx skill4agent add full-stack-skills/java-skills spring-boot-starter-patterns权威模板:(2.7.x,commit b091ee4)openclaw-spring-boot-starter/pom.xml
组织扩展:文末 §6;完整模板:assets/pom-template.xml
java-component-patterns| # | 错误 | 正确做法 |
|---|---|---|
| 1 | properties 平铺不分类不排序 | 三段式:基础→Third-Party→Maven Plugin,段内自然排序 |
| 2 | 删除 licenses/scm/developers | 保留并标准化(Central 发布必需),每段配中文注释 |
| 3 | | 写 |
| 4 | surefire argLine 丢 | 必须 |
| 5 | 把 okhttp/commons-io 当默认依赖 | 只有被集成组件是业务依赖;SB 四件套+被集成组件+lombok(按需)+test |
| 6 | 项目无 lombok 却保留 annotationProcessorPaths | 无 lombok → 连同 compiler 注解路径块一起删 |
| 7 | jacoco check 不设 haltOnFailure | |
| 8 | 用 JDK 26 编译 target 8 | |
| 9 | 以为 Maven 4 下必须改 model | M4 兼容 model 4.0.0(零改动);新特性(session scope 等)才需升级 4.1.0(仅 M4 可构建,详见 references/maven4.md) |
parent → 坐标 → name/description/url
→ licenses → scm → developers (Central 必需元数据)
→ properties(三段式) → dependencyManagement → dependencies
→ distributionManagement → build(pluginManagement+plugins)→ profiles① 基础(自然排序): java.version / maven.compiler.source+target / 两 encoding
② <!-- Third-Party Dependencies --> : 被集成组件版本
③ <!-- Maven Plugin Dependencies --> : 完整 22 插件版本| 分支 | SB parent | JDK |
|---|---|---|
| 2.3.x | 2.3.12.RELEASE | 8 |
| 2.7.x | 2.7.18 | 8 |
| 3.0.x~3.5.x | 3.0.13/3.1.12/3.2.12/3.3.13/3.4.13/3.5.16 | 17 |
| 4.0.x / 4.1.x | 4.0.7 / 4.1.0 | 21 |
{line}.x.{yyyyMMdd}-SNAPSHOT{line}.x.{yyyyMMdd}XxxAutoConfigurationXxxPropertiesXxxTemplateXxxAutoConfigurationTestXxxPropertiesTestmvn clean verify| 文件 | 何时读 |
|---|---|
| references/pom-structure.md | 写/改 pom 时:元素顺序详解、三段式全量示例、build 11 插件配置表、profiles 完整结构 |
| references/version-matrix.md | 分支/发版时:十分支全表、tag 发布 4 步、SNAPSHOT 滚动映射、SB parent 核对、JDK 兼容规则表 |
| references/maven4.md | 用 Maven 4 构建时:M3/M4 差异、运行 JDK 17+、maven.version 基线与 enforcer 区间、consumer POM、wrapper 迁移、CI 双轨 |
| examples/create-new-starter.md | 从零新建 starter 的 8 步完整演练(含验收标准) |
| examples/maven4-migration.md | 迁 Maven 4 时:双轨 enforcer、wrapper 切换、M4+JDK21 验证 release 8、consumer POM 检查、CI 双轨、按需升 model 4.1.0 |
| assets/pom-template.xml | Maven 3 / model 4.0.0 模板(M3/M4 双轨,XML 校验通过) |
| assets/pom-template-maven4.xml | Maven 4 / model 4.1.0 模板(enforcer [4.0.0,)、session scope 示例;仅 M4 可构建) |
要发布的东西是什么?
├── xxx-spring-boot-starter(整合某组件到 Spring Boot)→ 本 skill
└── 独立 Java 库/SDK(无 Spring 依赖,无 parent)→ java-component-patterns
依赖顺序: 组件先发正式版 → starter 再发io.github.easy4j2624322-release-6F6h6R2624322-snapshot-3EoOv3<a href="https://github.com/loong10k">Loong Wan</a>