chore: 支持发布到云效制品仓库,补齐发布元数据与 javadoc 配置

This commit is contained in:
caske 2026-11-16 17:39:53 +08:00
parent 4e9496e163
commit 1b431e9fb8
7 changed files with 1205 additions and 51 deletions

202
LICENSE Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

201
docs/consumer-guide.md Normal file
View file

@ -0,0 +1,201 @@
# Simple Starter 消费方接入指南
> 适用对象:需要在自己的项目中引入 `reliable.simple.starter:*` 的团队。
> 构件托管在**阿里云云效制品仓库**,不是 Maven Central,因此必须配置认证和仓库地址。
---
## 0. 先搞清楚坐标
云效「包列表」里显示的是 `reliable.simple.starter.simple-starter-job-core` 这种形式,它把 groupId 和 artifactId 用点号拼接显示了。**Maven 坐标不是这样的**:
```xml
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-job-core</artifactId>
```
包列表里有 60 个左右的包,是因为本项目的每个 `pom.xml`(叶子模块 + 聚合 POM)都会发布成一个构件。**业务方只需按需引用叶子模块**(如 `simple-starter-web`、`simple-starter-core`),聚合 POM(`simple-starter-job`、`simple-starter-cluster` 等)不用引,它们只是目录层级,删掉会破坏子模块的 parent 关系。
---
## 1. 配置认证(每个开发者必做)
在 `~/.m2/settings.xml` 中加入(该文件不存在就新建):
```xml
<settings>
<servers>
<server>
<id>repo-mtndz</id>
<username>你的云效账号</username>
<password>你的云效制品仓库密码</password>
</server>
</servers>
</settings>
```
> 该仓库公开性为「组织内可见」,**读也要认证**。没有这一步,`mvn` 会 401。
**IntelliJ IDEA 用户还需额外一步**:
`Settings → Build, Execution, Deployment → Build Tools → Maven → User settings file`
勾选 **Override**,指向同一个 `~/.m2/settings.xml`。否则命令行能拉、IDE 里仍报红。
---
## 2. 配置仓库地址(二选一)
### 方式 A:写在项目 `pom.xml`(单个项目接入)
在 `<project>` 下加:
```xml
<repositories>
<repository>
<id>repo-mtndz</id>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
```
### 方式 B:写在 `settings.xml`(公司统一配,推荐)
配一次,所有项目生效,业务方 POM 里完全不用写 `<repositories>`:
```xml
<settings>
<servers>
<server>
<id>repo-mtndz</id>
<username>你的云效账号</username>
<password>你的云效制品仓库密码</password>
</server>
</servers>
<profiles>
<profile>
<id>aliyun-repo</id>
<repositories>
<repository>
<id>repo-mtndz</id>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>aliyun-repo</activeProfile>
</activeProfiles>
</settings>
```
> 仓库地址也可以在云效控制台:`制品仓库 → simple-starter → 仓库指南 → Maven 配置` 查看与下载。
---
## 3. 导入 BOM 并添加依赖
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-bom</artifactId>
<version>2.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- 导入 BOM 后,任何模块都不用写 version -->
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-web</artifactId>
</dependency>
</dependencies>
```
也可以不导入 BOM,直接给单个依赖写 `<version>2.6.4</version>`(每个模块发布时都固化了传递依赖版本,不导 BOM 也能解析)。
---
## 4. 可引用的模块清单(无需写版本号)
| 分类 | artifactId(前缀均为 `reliable.simple.starter:`) |
| --- | --- |
| 基础 | `simple-starter-core` `simple-starter-json-jackson` `simple-starter-validation` `simple-starter-web` `simple-starter-doc` |
| 缓存 | `simple-starter-cache-redisson` `simple-starter-cache-jetcache` `simple-starter-cache-springcache` |
| 认证 | `simple-starter-auth-satoken` `simple-starter-auth-justauth` |
| 数据 | `simple-starter-data-core` `simple-starter-data-mp` |
| 加密 | `simple-starter-encrypt-api` `simple-starter-encrypt-core` `simple-starter-encrypt-field` `simple-starter-encrypt-password` |
| 验证码 | `simple-starter-captcha-graphic` `simple-starter-captcha-behavior` |
| 安全 | `simple-starter-security-xss` `simple-starter-security-mask` `simple-starter-security-sensitive` `simple-starter-security-idempotent` `simple-starter-security-ratelimiter` |
| 日志 | `simple-starter-log-core` `simple-starter-log-aop` `simple-starter-log-interceptor` `simple-starter-log-engine` |
| 消息 | `simple-starter-messaging-mail` `simple-starter-messaging-sse` `simple-starter-messaging-ws` `simple-starter-messaging-mqtt` |
| 文件 | `simple-starter-storage` |
| Excel | `simple-starter-excel-core` `simple-starter-excel-poi` `simple-starter-excel-fesod` |
| 增强 | `simple-starter-enhance-crud-core` `simple-starter-enhance-crud-mp` `simple-starter-enhance-datapermission-core` `simple-starter-enhance-datapermission-mp` `simple-starter-enhance-tenant-core` `simple-starter-enhance-tenant-mp` |
| 集群/任务/监控 | `simple-starter-cluster-grpc` `simple-starter-cluster-http-registry` `simple-starter-job-core` `simple-starter-metrics` `simple-starter-trace` `simple-starter-network` |
> 完整且权威的清单以 `simple-starter-bom` 的 `dependencyManagement` 为准。
---
## 5. 快照版(仅供联调,禁止进生产)
如需试用未定稿版本:
```xml
<version>2.6.4-SNAPSHOT</version>
```
同时把仓库的 `<snapshots><enabled>true</enabled></snapshots>` 打开,并强制刷新:
```bash
mvn -U clean package
```
`-U` 是必须的:Maven 对 SNAPSHOT 默认每天只检查一次更新,不加会拿到旧包。
---
## 6. 验证是否接通
```bash
mvn -U dependency:tree | grep simple-starter
```
能看到 `reliable.simple.starter:simple-starter-xxx:jar:2.6.4:compile` 及其传递依赖(Spring Boot 4.1.2、Hutool 5.8.48 等)就说明配置正确。
---
## 7. 常见问题
| 现象 | 原因与解决 |
| --- | --- |
| `401 Unauthorized` | 没配 `<server>`;或 `<server><id>` 与仓库 id `repo-mtndz` 不一致;或密码过期 |
| 命令能拉、IDE 报红 | IDEA 没 Override 指向同一份 `settings.xml`(见第 1 节) |
| `Could not find artifact` | ① 仓库地址没配或被 mirror 拦截;② 版本号写错(SNAPSHOT 与正式版是两个坐标) |
| mirror 导致拉不到 | `settings.xml` 中 `<mirrorOf>` 若含 `*`,必须排除本仓库:`*,!repo-mtndz` |
| 依赖版本冲突 | BOM 内置 `spring-boot-dependencies:4.1.2`,业务项目须使用 Spring Boot 4.1.x;若使用 3.x,会互相覆盖 |
| Web 模块容器冲突 | `simple-starter-web` 排除了 Tomcat 并引入 Jetty,业务项目若用 Tomcat 需先确认容器选型 |
| 拉到旧快照 | 加 `-U`;或在 `~/.m2/repository/reliable/simple/starter/` 下删掉对应版本目录 |
| `Non-resolvable parent POM` | 父 POM 未部署或权限不足;确认云效包列表里存在 `simple-starter`、`simple-starter-dependencies` |
---
## 8. 版本纪律
- **生产依赖只写正式版**(如 `2.6.4`),禁止 `-SNAPSHOT` 进生产或主干分支
- 正式版发布后内容**永不改动**;有问题就发下一个版本
- 快照可反复覆盖,仅用于联调阶段

View file

@ -0,0 +1,613 @@
# Simple Starter 发布为公共依赖库(Maven 发布落地指南)
> 目标:让任意 Java 项目通过一行 `<dependency>` 就能引入 Simple Starter 的各个模块。
> 本文档基于当前仓库真实状态编写,所有片段均可直接粘贴使用。
---
## 0. 现状盘点(先看清楚起点)
| 项 | 现状 | 位置 |
| --- | --- | --- |
| 坐标 | `reliable.simple.starter:*` | 各 `pom.xml` |
| 版本 | `${revision}` = `2.6.4` | `simple-starter-dependencies/pom.xml:66`(BOM 里还有一份 `simple-starter-bom/pom.xml:64`) |
| 构建 | 23 个一级模块,60+ 个可发布构件;JDK 21 编译 | 根 `pom.xml:17` |
| 版本规范化 | ✅ 已用 `flatten-maven-plugin`(`oss` 模式 + `parent expand`) | 根 `pom.xml:101` 起 |
| 源码包/文档包/GPG/中央发布 | ✅ 已有 `release` profile | `simple-starter-dependencies/pom.xml:692` 起 |
| BOM | ✅ `simple-starter-bom` 已管理约 48 个构件(含 `spring-boot-dependencies`) | `simple-starter-bom/pom.xml` |
| `distributionManagement`(发布目标仓库) | ✅ 已指向阿里云云效仓库 `repo-mtndz` | 父 POM 与 BOM 各一份 |
| `url` / `licenses` / `developers` / `scm` | ✅ 已补 | 父 POM 与 BOM 各一份 |
| `LICENSE` | ✅ 已补(Apache-2.0) | 仓库根目录 |
| 消费端仓库声明 / CI 发布流水线 | ❌ **缺失**(第 6.3、8 节给出模板) | — |
**关键结论**:技术地基已经打好(flatten + release profile),真正要做的是「补齐元数据 → 指定仓库 → 跑发布命令 → 验证消费」。**不需要重构构建体系。**
### 发布前必须人工确认的 4 个信息
1. **发到哪里?**(决定后面所有步骤,见第 1 节)
2. **groupId 是否需要改?**(中央仓库要求证明命名空间归属,`reliable.simple.starter` 不是自有域名,见 7.1)
3. **仓库地址与账号**(Nexus/GitLab 地址、deploy 账号或 Token)
4. **GPG 密钥**(仅中央仓库强制,私服可选)
---
## 1. 第一步:选定发布目标(决策点)
| 方案 | 适用场景 | 代价 | 结论 |
| --- | --- | --- | --- |
| **A. 本地 `mvn install`** | 只在同一台机器复用;临时验证 | 最低,0 配置 | 只用于联调 |
| **B1. 阿里云云效制品仓库** | 公司内部多项目共用,不想自建自维 | 需开通云效 + 组织内每人配凭证 | ✅ **本项目已选定** |
| **B2. 自建 Nexus(ECS)** | 需要匿名读、完全可控 | 需运维养机器 + 证书 + 备份 | 备选 |
| **C. GitLab Package Registry** | 复用现成 GitLab | 消费端必须带 Token | 备选 |
| **D. Maven Central** | 对公网开源 | 需域名/命名空间验证、GPG、Portal 审核 | 第 7 节的增量步骤 |
> 本文档以 **B1(阿里云云效制品仓库)为主线**,第 7 节给出 **D(Central)的增量步骤**;B2 与 C 只是换仓库地址,其余步骤完全相同。
---
## 2. 第二步:补齐 POM 元数据(所有模块统一继承)
元数据只需写在**父 POM**(`simple-starter-dependencies/pom.xml`),全部子模块自动继承。
> ⚠️ 例外:`simple-starter-bom/pom.xml` **没有 `<parent>`**(为保证可独立 import),必须单独写一份同样的元数据 + `distributionManagement`,否则它既无法 deploy 也无法通过仓库校验。
在 `simple-starter-dependencies/pom.xml` 的 `<description>` 之后插入:
```xml
<!-- ===== 发布元数据(Maven Central 强制要求,私服同样建议保留) ===== -->
<url>https://git.xcynet.com/pangu/simple-starter</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>pangu</id>
<name>Simple Starter Team</name>
<email>dev@xcynet.com</email>
<organization>XCYNet</organization>
<organizationUrl>https://www.xcynet.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://git.xcynet.com/pangu/simple-starter.git</connection>
<developerConnection>scm:git:ssh://git@git.xcynet.com/pangu/simple-starter.git</developerConnection>
<url>https://git.xcynet.com/pangu/simple-starter</url>
<tag>HEAD</tag>
</scm>
```
同时把仓库根目录缺失的 `LICENSE` 补上(Apache-2.0 全文),否则源码包/中央仓库校验会不通过:
```bash
curl -fsSL https://www.apache.org/licenses/LICENSE-2.0.txt -o LICENSE
```
> ⚠️ 顺手修一个隐患:`simple-starter-bom/pom.xml:16` 里又写死了 `<revision>2.6.4</revision>`,并且 `simple-starter-bom/pom.xml:18` 用的是 `spring-boot.version=4.1.0`,而父 POM 是 `4.1.2`。建议 BOM 删掉自己的 `revision`(从命令行/父级继承)并对齐 `spring-boot.version`,否则两份版本号容易跑偏。
---
## 3. 第三步:指定发布仓库(distributionManagement)
### 3.1 方案 B1:阿里云云效制品仓库(✅ 已选定并落地)
仓库信息(云效控制台「制品仓库 → simple-starter → 设置 → 基本信息」):
| 项 | 值 |
| --- | --- |
| 仓库名称 | `simple-starter` |
| 仓库 ID | `repo-mtndz` |
| 仓库模式 | **Hybrid**(Release + Snapshot 合一) |
| 公开性 | 组织内可见(**必须认证才能读**) |
| 仓库地址 | `https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz` |
因为是 Hybrid 模式,**只有一个地址**,`repository` 与 `snapshotRepository` 都指向它(用同一个 `id`,凭证只需配一份):
```xml
<distributionManagement>
<repository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</repository>
<snapshotRepository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</snapshotRepository>
</distributionManagement>
```
已在父 POM 与 BOM 各写一份,且实测未认证访问该地址返回 `401`(地址正确、仅缺凭证)。
> 若云效「仓库指南 → Maven 配置」页给出的 `server id` 不是 `repo-mtndz`,请以页面为准修改这两处 `id`,两边必须逐字符一致。
### 3.2 备选方案:GitLab Package Registry
```xml
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://git.xcynet.com/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://git.xcynet.com/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
</snapshotRepository>
</distributionManagement>
```
> 本地发布时 `CI_PROJECT_ID` 为空,需要显式传 `-DCI_PROJECT_ID=<项目数字ID>`(项目 ID 在 GitLab 项目首页可见),或直接把 ID 写死。
### 3.3 ❗ 必须做的两处配套修改(否则父 POM 自己发不上去)
**根因(实测发现,比预想的更隐蔽)**:`simple-starter-dependencies` 的 POM 里有一个 `xml-maven-plugin` 后处理步骤,用 XSLT 把 `.flattened-pom.xml` 里的 `distributionManagement` **显式删掉了**:
`simple-starter-dependencies/src/main/xslt/post-process-flattened-pom.xsl`(原第 30 行):
```xml
<xsl:template match="/m:project/m:distributionManagement" />
```
而 `mvn deploy` 用的是 flatten 后的 POM,于是父 POM 发布失败 → 所有子模块报 `Non-resolvable parent POM`。**只加 `<distributionManagement>keep</distributionManagement>` 没用**,因为 XSLT 在该阶段之后才执行。
需要两处一起改(已落地):
**① `simple-starter-dependencies/pom.xml` 的 `flatten` execution(`pomElements` 中)**
```xml
<pomElements>
<parent>expand</parent>
<properties>keep</properties>
<pluginManagement>keep</pluginManagement>
<repositories>remove</repositories>
<!-- bom 模式默认删除 distributionManagement,会导致本 POM 自身无法 deploy -->
<distributionManagement>keep</distributionManagement>
</pomElements>
```
**② `simple-starter-dependencies/src/main/xslt/post-process-flattened-pom.xsl`:移除该删除模板**
```xml
<!-- 保留 distributionManagement:deploy 使用的是本文件的产物,
删除后本模块自身将无法发布到远程仓库(子模块也会因找不到 parent 而失败) -->
```
> `simple-starter-bom` 的 POM **没有 `<parent>`**,无法继承父 POM 的 `distributionManagement`,必须在这个文件里单独写一份(已落地),否则 BOM 会报 `distributionManagement not specified`。
**验证方法**(这一步别跳过):
```bash
mvn -pl simple-starter-dependencies,simple-starter-bom process-resources -q
grep -A6 distributionManagement simple-starter-dependencies/.flattened-pom.xml
grep -A6 distributionManagement simple-starter-bom/.flattened-pom.xml
# 两个文件都必须能看到 packages.aliyun.com 与 repo-mtndz
```
已实测通过:`simple-starter-core` 的 `.flattened-pom.xml` 与安装到 `~/.m2` 的 `simple-starter-core-2.6.4.pom` 均保留了 `distributionManagement`、`licenses`、`scm`。
---
## 4. 第四步:配置发布凭据(`~/.m2/settings.xml`)
`<server>` 的 `id` **必须**与第 3 步中的仓库 `id` 完全一致(当前为 `repo-mtndz`)。
Hybrid 模式只有一个仓库,所以**只需配一个 server**:
```xml
<settings>
<servers>
<!-- id 必须与 POM 中 distributionManagement/repository 的 id 一致 -->
<server>
<id>repo-mtndz</id>
<username>云效用户名</username>
<password>云效制品仓库密码</password>
</server>
</servers>
</settings>
```
最省事的做法:云效仓库页 → 左侧「**仓库指南**」→「Maven 配置」,页面会生成完整 `settings.xml`,直接下载覆盖 `~/.m2/settings.xml`,无需手工抄用户名密码。
> ⚠️ 与 Nexus 的差异:该仓库公开性是「**组织内可见**」,意味着**读也要认证**。除了发布机,**每个要依赖 simple-starter 的开发者、每条 CI 流水线都必须配这份 `settings.xml`**,否则拉包会 401。这是选云效的主要代价。
>
> 安全建议:CI 里用 `mvn -s ci-settings.xml` + CI Variables 注入,**不要提交密码**。
---
## 5. 第五步:执行发布
### 5.1 发布命令(Release)
> ⚠️ **必须带 `-Dmaven.resolver.transport=wagon`**,原因见下方「为什么必须加 wagon」。
```bash
# 1) 试发快照:验证整条链路,可反复覆盖
mvn -Prelease -DskipTests -Drevision=2.6.4-SNAPSHOT \
-Dmaven.resolver.transport=wagon clean deploy
# 2) 确认无误后发正式版(不可覆盖)
mvn -Prelease -DskipTests -Drevision=2.6.4 \
-Dmaven.resolver.transport=wagon clean deploy
# 3) 打 tag,与发布的版本对齐
git tag 2.6.4 && git push origin 2.6.4
```
说明:
- `-Prelease` 只激活 **sources jar / javadoc jar**(便于同事在 IDE 里看源码),**不签名、不发 Central**,内部发布用这一个 profile 即可。
- GPG 签名与 Central 上传已拆到独立的 `central` profile,只有发 Maven Central 时才需要 `-Prelease,central`(见 7.4)。
- `-Drevision=2.6.4` 会覆盖 POM 中的 `<revision>`,flatten 插件负责把它固化进发布用的 POM,**不需要手工改 60 个 pom**。
- 快照与正式版只差一个 `-SNAPSHOT` 后缀,Hybrid 仓库会自动处理,无需换地址。
#### 为什么必须加 `-Dmaven.resolver.transport=wagon`
这是本项目在云效上遇到的真实故障,不加就必挂:
```
[ERROR] ... maven-deploy-plugin:3.2.0:deploy on project simple-starter-bom:
[ERROR] Failed to retrieve remote metadata ... maven-metadata.xml:
[ERROR] Could not transfer metadata ... from/to repo-mtndz: RFC9457Payload
```
根因链路:
1. 首次发布时,Maven 会先 `GET` 目标位置的 `maven-metadata.xml`(快照还需要合并 timestamp/buildNumber);
2. 云效对**不存在的路径**返回 `404` + `Content-Type: application/json;charset=UTF-8` + **空 body**;
3. Maven 3.9+ 的 native transport 看到 `application/json` 就按 RFC 9457 Problem Details 解析,空 body 解析失败 → 抛 `RFC9457Payload`;
4. 于是「资源不存在(正常)」被误判成「传输错误」,deploy 直接失败。
`wagon` 是 Maven 3.9 之前的旧 HTTP 实现,不认识 Problem Details,404 会被正常忽略。Maven 3.10 发行版自带 `maven-resolver-transport-wagon`,加参数即可,**不需要改任何服务器配置**。
> 验证记录:加上该参数后,`mvn -Prelease -DskipTests -Drevision=2.6.4-SNAPSHOT clean deploy` 全量成功,60+ 模块共上传 335 个文件,耗时 6 分 23 秒。
>
> 代价:wagon 不支持并行下载,日常 `install` 拉依赖会略慢。所以**建议只在 deploy 时加**,不要写进 `.mvn/maven.config` 全局启用。若团队经常忘记加,可封装成 `scripts/release.sh`。
### 5.2 常见干扰项(发布时按需加参数)
| 现象 | 处理 |
| --- | --- |
| `RFC9457Payload` / `Failed to retrieve remote metadata` | 缺 `-Dmaven.resolver.transport=wagon`(见 5.1) |
| spotless 在 `compile` 阶段改写源码,CI 上产生脏工作区 | 发布前先 `mvn spotless:apply`,然后加 `-Dspotless.apply.skip=true` |
| 不想在发布机上跑测试 | `-DskipTests`(不推荐,至少发布前跑一次全量) |
| javadoc 报 `malformed HTML` / `end tag missing` | 已在 `release` profile 的 javadoc 插件关闭 doclint(`<doclint>none</doclint>` + `-Xdoclint:none`),无需处理 |
| javadoc 阶段太慢(占发布耗时大头) | `-Dmaven.javadoc.skip=true`,代价是包里没有 `-javadoc.jar`(sources 仍在,IDE 仍能看源码) |
| 网络慢/离线 | `-o` 离线构建仅用于 install,不要用于 deploy;且 `settings.xml` 变更后 `-o` 可能因 `_remote.repositories` 校验失败 |
---
## 6. 第六步:消费端如何引入(这是"公共依赖库"的验收标准)
### 6.1 方式一:BOM + 具体 starter(推荐)
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-bom</artifactId>
<version>2.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- 按需引入,无需写版本号 -->
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-web</artifactId>
</dependency>
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-log-aop</artifactId>
</dependency>
</dependencies>
```
### 6.2 方式二:单模块直接引(不导入 BOM)
```xml
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-core</artifactId>
<version>2.6.4</version>
</dependency>
```
> 可行原因:flatten 已把父 POM 的 `dependencyManagement` 解析进每个模块自己的发布 POM(跨模块依赖版本也已是硬编码版本号),所以不导入 BOM 也能解析。
### 6.3 消费端仓库声明(私服不是中央镜像时必配)
在消费项目 POM 里加(云效只有一个 Hybrid 地址,同时开启 snapshots 才能吃到 `-SNAPSHOT`):
```xml
<repositories>
<repository>
<id>repo-mtndz</id>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
```
> 消费端的 `id` 与 `<server>` 也要对得上(同样配在各自开发机的 `~/.m2/settings.xml`)。若公司项目很多,建议把这段放进 `settings.xml` 的 `<profiles>` 并设为 `activeProfile`,不必每个项目都写一遍。
### 6.4 冒烟测试(发布后**必做**,否则等于没验收)
```bash
# 建一个空项目,只依赖一个最重的模块
mkdir -p /tmp/consumer && cd /tmp/consumer
cat > pom.xml <<'EOF'
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId><artifactId>consumer</artifactId><version>1.0</version>
<dependencies>
<dependency>
<groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-web</artifactId>
<version>2.6.4</version>
</dependency>
</dependencies>
</project>
EOF
mvn -U -q dependency:tree | head -50
```
会拉通说明:POM 可解析、parent 可解析、传递依赖版本收敛正常、sources/javadoc 不阻断消费。
---
## 7. 第七步(可选):发布到 Maven Central
仅在确实要对公网开源时做。在方案 B 的基础上增量改动 4 处。
### 7.1 ❗ 先解决 groupId 命名空间
中央仓库要求 groupId 必须是**你拥有的域名反写**,或 `io.github.<用户名>` / `com.gitee.<用户名>` 这类免验证前缀。`reliable.simple.starter` 不对应任何可注册域名,**会被直接拒绝**。
三个选项:
1. 用公司自有域名反写,例如 `com.xcynet.pangu`(需在 DNS 上做 TXT 记录验证);
2. `io.github.<github用户名>`(需要 GitHub 账号,`com.gitee.<用户名>` 同理);
3. 不发布中央,只做私服(推荐,改动为 0)。
**必须在首次发布前定下来**,之后修改 groupId 对消费方是破坏性变更。全局替换命令:
```bash
# macOS
grep -rl "reliable.simple.starter" --include=pom.xml . | xargs sed -i '' 's/reliable\.simple\.starter/com.xcynet.pangu/g'
# Linux
grep -rl "reliable.simple.starter" --include=pom.xml . | xargs sed -i 's/reliable\.simple\.starter/com.xcynet.pangu/g'
```
改完 `mvn -q clean install` 全量回归一遍。
### 7.2 GPG 签名
```bash
brew install gnupg # 已装则跳过
gpg --full-generate-key # RSA 4096,有效期按公司规范
gpg --list-secret-keys --keyid-format LONG # 记下 KEY_ID
gpg --keyserver keyserver.ubuntu.com --send-keys <KEY_ID>
```
发布时提供口令(gpg 插件 3.x 支持环境变量,避免明文):
```bash
export MAVEN_GPG_PASSPHRASE='你的私钥密码'
```
`maven-gpg-plugin:3.1.0` 已绑定 `verify` 阶段,现位于 **`central` profile** 中(`-Pcentral` 才激活),内部发布不会触发它,因此发布到云效不需要任何 GPG 准备。
### 7.3 Sonatype 账号与 Token
1. 在 https://central.sonatype.com 注册并创建 **User Token**(得到 username/password 一对);
2. 在 `settings.xml` 增加 Server,`id` 必须与 `publishingServerId` 一致(当前配置为 `central`):
```xml
<server>
<id>central</id>
<username>token用户名</username>
<password>token密码</password>
</server>
```
### 7.4 修正 `central-publishing-maven-plugin` 的挂载位置
当前它写在 `simple-starter-dependencies` 的 `release` profile 里,**并且 `simple-starter-bom` 里还有一份独立的同名插件配置**(因为 BOM 没有 parent)。两份都会被本次 reactor 使用,且父 POM 那份还会被 60+ 模块继承。该插件是「代理整个 reactor 的 deploy」,应只在聚合根挂一次,否则可能出现多个 bundle / 互相覆盖。
✅ **已落地**:profile 已按用途拆开(父 POM 与 BOM 同步修改):
| profile | 内容 | 用途 |
| --- | --- | --- |
| `release` | `maven-source-plugin` + `maven-javadoc-plugin` | 内部发布到云效,产出 `-sources.jar` / `-javadoc.jar` |
| `central` | `maven-gpg-plugin` + `central-publishing-maven-plugin` | 发布 Maven Central,需 `-Prelease,central` 同时激活 |
这样拆的原因是:`central-publishing-maven-plugin` 带 `<extensions>true</extensions>`,会接管 `deploy` 阶段。如果它留在 `release` profile 里,每次内部发布都会被它劫持(去尝试上传 bundle 到 Central),必然失败。拆开后内部发布链路干净,也不要求配 GPG。
```xml
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<!-- package 阶段 jar-no-fork -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<!-- package 阶段 jar -->
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>central</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<!-- verify 阶段 sign -->
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.4.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
```
### 7.5 中央发布命令与人工审核
```bash
mvn -Prelease,central -Drevision=<版本> -DskipTests clean deploy
```
deploy 结束后到 https://central.sonatype.com/publishing/deployments 查看 bundle 状态:
`VALIDATED` → 点 **Publish** → 约 10~30 分钟后同步到 Maven Central。
> 已知小坑:`simple-starter-dependencies` 用 `build-helper-maven-plugin` 额外挂了一个 `effective-pom` 类型的附件(`pom.xml:560-583`),Central Portal 对非标准 artifact 类型较敏感。若校验报告 artifact 类型非法,把该 execution 挪到独立的 `-Pdoc` profile 里,发布时默认不激活。
---
## 8. 第八步:CI 自动化(GitLab CI)
在仓库根新增 `.gitlab-ci.yml`:
```yaml
stages: [build, release]
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dfile.encoding=UTF-8"
MAVEN_CLI: "mvn -B -ntp"
cache:
key: maven-$CI_COMMIT_REF_SLUG
paths: [.m2/repository]
build:
stage: build
image: maven:3.9-eclipse-temurin-21
script:
- $MAVEN_CLI clean verify -Dspotless.apply.skip=true
artifacts:
when: always
reports:
junit: "**/target/surefire-reports/TEST-*.xml"
# 仅打 tag 时发正式版,tag 名即版本号(如 2.6.4)
release:
stage: release
image: maven:3.9-eclipse-temurin-21
script:
- $MAVEN_CLI -Prelease -Drevision=$CI_COMMIT_TAG -DskipTests -Dmaven.resolver.transport=wagon -s ci-settings.xml clean deploy
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
```
`ci-settings.xml`(凭据从 CI Variables 注入,**不要提交**):
```xml
<settings>
<servers>
<server>
<id>repo-mtndz</id>
<username>${env.ALIYUN_USER}</username>
<password>${env.ALIYUN_PASS}</password>
</server>
</servers>
</settings>
```
> `ci-settings.xml` 含变量占位,需加进 `.gitignore`(模板可用 `ci-settings.example.xml` 形式提交)。
---
## 9. 发布后验收清单(Checklist)
逐条打勾,全绿才算真正"成了公共依赖库":
- [ ] `~/.m2/repository/reliable/simple/starter/simple-starter-core/2.6.4/` 下同时存在 `.jar`、`.pom`、`-sources.jar`、`-javadoc.jar`(Central 还需要 `.asc`)
- [ ] 父 POM 已发布:`simple-starter-dependencies/2.6.4/*.pom` 与 `simple-starter/2.6.4/*.pom` 存在(**子模块能解析 parent 的前提**)
- [ ] `.flattened-pom.xml` 中版本号已从 `${revision}` 变成硬编码版本,且跨模块依赖带明确 `<version>`
- [ ] `simple-starter-bom/2.6.4/*.pom` 已发布,`mvn help:effective-pom` 能看到 BOM 里的 spring-boot 版本
- [ ] 第 6.4 节的 consumer 冒烟项目 `dependency:tree` 无红色错误、无重复冲突版本
- [ ] 消费方应用启动正常,`spring.factories` / `AutoConfiguration.imports` 被正确加载
- [ ] 仓库里能看到 `maven-metadata.xml` 已包含新版本号(说明 release 仓库不是只读/部署被静默忽略)
- [ ] Git tag 与已发布版本一一对应
---
## 10. 常见坑速查
| 坑 | 症状 | 解法 |
| --- | --- | --- |
| 云效返回 404 被当成传输错误 | `RFC9457Payload` | 加 `-Dmaven.resolver.transport=wagon`(见 5.1,必踩) |
| 父 POM 未发布 | 消费端报 `Non-resolvable parent POM` | 检查 3.3 的 `distributionManagement>keep`;确认 `simple-starter-dependencies`、`simple-starter` 都进了仓库 |
| server id 不匹配 | `401 Unauthorized` / `Return code is: 401` | `settings.xml` 的 `<server><id>` 必须与仓库 `id` 逐字符一致 |
| release 仓库拒绝覆盖 | `400 Bad Request` / `409` | Release 仓库通常禁止覆盖同版本;要么升版本,要么让运维开权限 |
| 快照发到 release 仓库 | 版本被追加时间戳却不在 snapshot 列表 | `-SNAPSHOT` 后缀必须存在,且 `snapshotRepository` 已配置 |
| 传了 POM 但缺 jar | 消费端 `Could not find artifact` | 某模块 `packaging` 配置错,或 deploy 中途失败(看日志第一个 ERROR) |
| javadoc 打包失败卡住发布 | `Javadoc generation failed` | 父 POM 已有 `failOnError=false`;个别模块加 `maven.javadoc.skip` |
| 发布过程被 spotless 改写源码 | CI 工作区脏、二次构建 diff | 先 `mvn spotless:apply` 提交,发布时 `-Dspotless.apply.skip=true` |
| `-Drevision` 改了但 POM 里还是旧版本 | 发布出旧版本号 | flatten 在根 `pom.xml` 的 `build` 中始终生效,与 profile 无关;检查 BOM 是否把 `<revision>` 写死(BOM 无 parent,确实写了一份) |
| 本地能跑、消费端缺类 | `NoClassDefFoundError` | 该依赖标了 `<optional>true</optional>`,消费方需自己显式引入 |
---
## 11. 一页版执行顺序(TL;DR)
### 已完成的改动(本轮已落地并验证)
| 文件 | 改动 |
| --- | --- |
| `simple-starter-dependencies/pom.xml` | 新增 `url` / `licenses` / `developers` / `scm`;新增 `distributionManagement`(指向云效 `repo-mtndz`);flatten `pomElements` 加 `distributionManagement>keep` |
| `simple-starter-dependencies/src/main/xslt/post-process-flattened-pom.xsl` | 删除「移除 distributionManagement」的模板(真正根因) |
| `simple-starter-bom/pom.xml` | 新增独立的元数据 + `distributionManagement`(无 parent);flatten 同上加 keep;`spring-boot.version` 4.1.0 → **4.1.2** 对齐父 POM |
| `simple-starter-dependencies/pom.xml` + `simple-starter-bom/pom.xml` | 拆分 profile:`release`(sources/javadoc)与 `central`(gpg + Central 上传)分离,内部发布不再被 Central 插件劫持;`distributionManagement` 的 `<id>` 对齐云效为 `repo-mtndz` |
| `simple-starter-dependencies/pom.xml` + `simple-starter-bom/pom.xml` | javadoc 插件关闭 doclint(`<doclint>none</doclint>` + `-Xdoclint:none`),修复 22 个模块因注释内 HTML 不规范而缺失 `-javadoc.jar` |
| `LICENSE` | 新增 Apache-2.0 全文(202 行) |
已实测:`mvn -o -DskipTests -pl simple-starter-core -am install` 成功;外部空白项目 `dependency:tree` 能完整解析出 `simple-starter-core:2.6.4` 及其传递依赖(spring-boot 4.1.2 / hutool 5.8.48 等)。
### 仍需你执行的(凭证已配好,直接发布)
```bash
# 1. 试发快照:验证整条链路(快照可反复覆盖,出错无成本)
# 注意必须带 -Dmaven.resolver.transport=wagon
mvn -Prelease -DskipTests -Drevision=2.6.4-SNAPSHOT \
-Dmaven.resolver.transport=wagon clean deploy
# 2. 到云效「包列表」确认构件数量(应从 0 变成 60 左右)、坐标正确
# 3. 发正式版(release 不可覆盖,确认无误再执行)
mvn -Prelease -DskipTests -Drevision=2.6.4 \
-Dmaven.resolver.transport=wagon clean deploy
git tag 2.6.4 && git push origin 2.6.4
# 4. 消费端冒烟(第 6.4 节,消费端也要配同一份 settings.xml)
```
**仓库地址与凭证均已就绪,无需再改任何配置**。构建体系无需重构。

View file

@ -66,6 +66,9 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<compilerArgument>-parameters</compilerArgument> <compilerArgument>-parameters</compilerArgument>
<!-- JDK 23+ 默认关闭注解处理(javac -proc 默认值变更),不显式指定 full 会导致
Lombok 处理器不运行,getter/setter/@Slf4j 的 log 全部“找不到符号” -->
<proc>full</proc>
</configuration> </configuration>
</plugin> </plugin>
<!-- 代码格式化插件 --> <!-- 代码格式化插件 -->

View file

@ -12,10 +12,59 @@
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>Simple Starter BOM</description> <description>Simple Starter BOM</description>
<!-- ==================== 发布元数据 ====================
本 POM 无 parent,无法继承 simple-starter-dependencies 的元数据,
发布到私服 / Maven Central 时必须在此单独声明。 -->
<url>https://git.xcynet.com/pangu/simple-starter</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>pangu</id>
<name>Simple Starter Team</name>
<email>dev@xcynet.com</email>
<organization>XCYNet</organization>
<organizationUrl>https://www.xcynet.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://git.xcynet.com/pangu/simple-starter.git</connection>
<developerConnection>scm:git:ssh://git@git.xcynet.com/pangu/simple-starter.git</developerConnection>
<url>https://git.xcynet.com/pangu/simple-starter</url>
<tag>HEAD</tag>
</scm>
<!-- ==================== 发布目标仓库(阿里云云效制品仓库) ====================
本 POM 无 parent,必须与 simple-starter-dependencies 保持同一套地址与 id。
仓库为 Hybrid 模式,Release 与 Snapshot 共用同一地址。 -->
<distributionManagement>
<repository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</repository>
<snapshotRepository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</snapshotRepository>
</distributionManagement>
<properties> <properties>
<!-- 本 POM 无 parent,版本号只能在此单独维护;
发布时统一用 -Drevision=x.y.z 覆盖(用户属性优先级高于此处),
若手工改版本,必须同步修改 simple-starter-dependencies/pom.xml 中的 revision -->
<revision>2.6.4</revision> <revision>2.6.4</revision>
<!-- 对齐 simple-starter-dependencies 的 Spring Boot 版本 --> <!-- 必须与 simple-starter-dependencies 的 spring-boot.version 保持一致 -->
<spring-boot.version>4.1.0</spring-boot.version> <spring-boot.version>4.1.2</spring-boot.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -33,244 +82,244 @@
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-core</artifactId> <artifactId>simple-starter-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- JSON 模块 - Jackson --> <!-- JSON 模块 - Jackson -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-json-jackson</artifactId> <artifactId>simple-starter-json-jackson</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- API 文档模块 --> <!-- API 文档模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-doc</artifactId> <artifactId>simple-starter-doc</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 校验模块 --> <!-- 校验模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-validation</artifactId> <artifactId>simple-starter-validation</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- Web 模块 --> <!-- Web 模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-web</artifactId> <artifactId>simple-starter-web</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 缓存模块 - Redisson --> <!-- 缓存模块 - Redisson -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-cache-redisson</artifactId> <artifactId>simple-starter-cache-redisson</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 缓存模块 - Spring Cache --> <!-- 缓存模块 - Spring Cache -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-cache-springcache</artifactId> <artifactId>simple-starter-cache-springcache</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 缓存模块 - JetCache --> <!-- 缓存模块 - JetCache -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-cache-jetcache</artifactId> <artifactId>simple-starter-cache-jetcache</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 认证模块 - SaToken --> <!-- 认证模块 - SaToken -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-auth-satoken</artifactId> <artifactId>simple-starter-auth-satoken</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 认证模块 - JustAuth --> <!-- 认证模块 - JustAuth -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-auth-justauth</artifactId> <artifactId>simple-starter-auth-justauth</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 数据访问模块 - MyBatis Plus --> <!-- 数据访问模块 - MyBatis Plus -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-data-mp</artifactId> <artifactId>simple-starter-data-mp</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 数据访问模块 - 核心模块 --> <!-- 数据访问模块 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-data-core</artifactId> <artifactId>simple-starter-data-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 加密模块 - 字段加密 --> <!-- 加密模块 - 字段加密 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-encrypt-field</artifactId> <artifactId>simple-starter-encrypt-field</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 加密模块 - API 加密 --> <!-- 加密模块 - API 加密 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-encrypt-api</artifactId> <artifactId>simple-starter-encrypt-api</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 加密模块 - 密码编码器 --> <!-- 加密模块 - 密码编码器 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-encrypt-password</artifactId> <artifactId>simple-starter-encrypt-password</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 加密模块 - 核心模块 --> <!-- 加密模块 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-encrypt-core</artifactId> <artifactId>simple-starter-encrypt-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 验证码模块 - 图形验证码 --> <!-- 验证码模块 - 图形验证码 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-captcha-graphic</artifactId> <artifactId>simple-starter-captcha-graphic</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 验证码模块 - 行为验证码 --> <!-- 验证码模块 - 行为验证码 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-captcha-behavior</artifactId> <artifactId>simple-starter-captcha-behavior</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 安全模块 - 脱敏 --> <!-- 安全模块 - 脱敏 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-security-mask</artifactId> <artifactId>simple-starter-security-mask</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 安全模块 - XSS 过滤 --> <!-- 安全模块 - XSS 过滤 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-security-xss</artifactId> <artifactId>simple-starter-security-xss</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 安全模块 - 敏感词 --> <!-- 安全模块 - 敏感词 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-security-sensitive</artifactId> <artifactId>simple-starter-security-sensitive</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 限流模块 --> <!-- 限流模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-security-ratelimiter</artifactId> <artifactId>simple-starter-security-ratelimiter</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 幂等模块 --> <!-- 幂等模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-security-idempotent</artifactId> <artifactId>simple-starter-security-idempotent</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 链路追踪模块 --> <!-- 链路追踪模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-trace</artifactId> <artifactId>simple-starter-trace</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 消息模块 - 邮件 --> <!-- 消息模块 - 邮件 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-messaging-mail</artifactId> <artifactId>simple-starter-messaging-mail</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 消息模块 - ws --> <!-- 消息模块 - ws -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-messaging-ws</artifactId> <artifactId>simple-starter-messaging-ws</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 消息模块 - SSE --> <!-- 消息模块 - SSE -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-messaging-sse</artifactId> <artifactId>simple-starter-messaging-sse</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 消息模块 - MQTT --> <!-- 消息模块 - MQTT -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-messaging-mqtt</artifactId> <artifactId>simple-starter-messaging-mqtt</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 日志模块 - 基于拦截器实现(Spring Boot Actuator HttpTrace 增强版) --> <!-- 日志模块 - 基于拦截器实现(Spring Boot Actuator HttpTrace 增强版) -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-log-interceptor</artifactId> <artifactId>simple-starter-log-interceptor</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 日志模块 - 基于 AOP 实现 --> <!-- 日志模块 - 基于 AOP 实现 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-log-aop</artifactId> <artifactId>simple-starter-log-aop</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 日志模块 - 核心模块 --> <!-- 日志模块 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-log-core</artifactId> <artifactId>simple-starter-log-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 日志模块 - 异步持久化引擎 --> <!-- 日志模块 - 异步持久化引擎 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-log-engine</artifactId> <artifactId>simple-starter-log-engine</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 监控模块 - Micrometer + Prometheus 指标采集 --> <!-- 监控模块 - Micrometer + Prometheus 指标采集 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-metrics</artifactId> <artifactId>simple-starter-metrics</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- Excel 文件处理模块 - Fesod --> <!-- Excel 文件处理模块 - Fesod -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-excel-fesod</artifactId> <artifactId>simple-starter-excel-fesod</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- Excel 文件处理模块 - POI --> <!-- Excel 文件处理模块 - POI -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-excel-poi</artifactId> <artifactId>simple-starter-excel-poi</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- Excel 文件处理模块 - 核心模块 --> <!-- Excel 文件处理模块 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-excel-core</artifactId> <artifactId>simple-starter-excel-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 存储模块 --> <!-- 存储模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-storage</artifactId> <artifactId>simple-starter-storage</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
@ -278,69 +327,69 @@
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-crud-mp</artifactId> <artifactId>simple-starter-enhance-crud-mp</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - CRUD - MyBatis Flex ORM 模块 --> <!-- 扩展模块 - CRUD - MyBatis Flex ORM 模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-crud-mf</artifactId> <artifactId>simple-starter-enhance-crud-mf</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - CRUD - 核心模块 --> <!-- 扩展模块 - CRUD - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-crud-core</artifactId> <artifactId>simple-starter-enhance-crud-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - 数据权限 - MyBatis Plus ORM 模块 --> <!-- 扩展模块 - 数据权限 - MyBatis Plus ORM 模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-datapermission-mp</artifactId> <artifactId>simple-starter-enhance-datapermission-mp</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - 数据权限 - 核心模块 --> <!-- 扩展模块 - 数据权限 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-datapermission-core</artifactId> <artifactId>simple-starter-enhance-datapermission-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - 租户 - MyBatis Plus ORM 模块 --> <!-- 扩展模块 - 租户 - MyBatis Plus ORM 模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-tenant-mp</artifactId> <artifactId>simple-starter-enhance-tenant-mp</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 扩展模块 - 租户 - 核心模块 --> <!-- 扩展模块 - 租户 - 核心模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-enhance-tenant-core</artifactId> <artifactId>simple-starter-enhance-tenant-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-network</artifactId> <artifactId>simple-starter-network</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- gRPC 模块 - etcd 服务注册发现 --> <!-- gRPC 模块 - etcd 服务注册发现 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-cluster-grpc</artifactId> <artifactId>simple-starter-cluster-grpc</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- HTTP 服务注册发现模块 --> <!-- HTTP 服务注册发现模块 -->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-cluster-http-registry</artifactId> <artifactId>simple-starter-cluster-http-registry</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
<!--任务调度核心模块--> <!--任务调度核心模块-->
<dependency> <dependency>
<groupId>reliable.simple.starter</groupId> <groupId>reliable.simple.starter</groupId>
<artifactId>simple-starter-job-core</artifactId> <artifactId>simple-starter-job-core</artifactId>
<version>${revision}</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -388,6 +437,8 @@
<properties>keep</properties> <properties>keep</properties>
<pluginManagement>keep</pluginManagement> <pluginManagement>keep</pluginManagement>
<repositories>remove</repositories> <repositories>remove</repositories>
<!-- bom 模式默认删除 distributionManagement,会导致本 POM 自身无法 deploy -->
<distributionManagement>keep</distributionManagement>
</pomElements> </pomElements>
</configuration> </configuration>
</execution> </execution>
@ -404,6 +455,7 @@
</build> </build>
<profiles> <profiles>
<!-- 内部发布(云效私服):产出 sources/javadoc 包 -->
<profile> <profile>
<id>release</id> <id>release</id>
<build> <build>
@ -423,6 +475,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>none</doclint>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -432,6 +488,15 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins>
</build>
</profile>
<!-- 发布到 Maven Central:需同时激活 -Prelease,central -->
<profile>
<id>central</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>

View file

@ -12,6 +12,55 @@
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>Simple Starter 依赖模块</description> <description>Simple Starter 依赖模块</description>
<!-- ==================== 发布元数据 ====================
Maven Central 强制要求以下四段;内部私服发布同样建议保留。
发布到 Maven Central 时,需将 url / scm 替换为可公网访问的真实地址。 -->
<url>https://git.xcynet.com/pangu/simple-starter</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<developers>
<developer>
<id>pangu</id>
<name>Simple Starter Team</name>
<email>dev@xcynet.com</email>
<organization>XCYNet</organization>
<organizationUrl>https://www.xcynet.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://git.xcynet.com/pangu/simple-starter.git</connection>
<developerConnection>scm:git:ssh://git@git.xcynet.com/pangu/simple-starter.git</developerConnection>
<url>https://git.xcynet.com/pangu/simple-starter</url>
<tag>HEAD</tag>
</scm>
<!-- ==================== 发布目标仓库(阿里云云效制品仓库) ====================
仓库名为 simple-starter,模式为 Hybrid(Release + Snapshot 同一仓库),
因此 repository 与 snapshotRepository 使用同一个 URL。
<id> 必须与 ~/.m2/settings.xml 中 <server> 的 id 逐字符一致,否则 deploy 报 401。
该 id 取自云效自动生成的 settings.xml,即本仓库的仓库 ID。 -->
<distributionManagement>
<repository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</repository>
<snapshotRepository>
<id>repo-mtndz</id>
<name>Alyun Devops Maven Repository</name>
<url>https://packages.aliyun.com/6916925f9add35de197b8556/maven/repo-mtndz</url>
</snapshotRepository>
</distributionManagement>
<properties> <properties>
<!-- Project Version --> <!-- Project Version -->
<revision>2.6.4</revision> <revision>2.6.4</revision>
@ -491,6 +540,8 @@
<properties>keep</properties> <properties>keep</properties>
<pluginManagement>keep</pluginManagement> <pluginManagement>keep</pluginManagement>
<repositories>remove</repositories> <repositories>remove</repositories>
<!-- bom 模式默认删除 distributionManagement,会导致本 POM 自身无法 deploy -->
<distributionManagement>keep</distributionManagement>
</pomElements> </pomElements>
</configuration> </configuration>
</execution> </execution>
@ -637,6 +688,8 @@
</build> </build>
<profiles> <profiles>
<!-- 内部发布(云效私服):产出 sources/javadoc 包,便于同事在 IDE 中查看源码。
不签名、不发布到 Maven Central。使用方式:mvn -Prelease -Drevision=x.y.z deploy -->
<profile> <profile>
<id>release</id> <id>release</id>
<build> <build>
@ -656,6 +709,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- 关闭 doclint 的 HTML/语法强校验:部分注释含未转义 <T> 或未闭合 <code>,
会生成 error 并导致该模块缺失 -javadoc.jar -->
<doclint>none</doclint>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -665,6 +724,16 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins>
</build>
</profile>
<!-- 发布到 Maven Central:需同时激活 -Prelease,central,并事先配置 GPG 密钥与 Sonatype Token。
单独使用 -Prelease 时不会触发本 profile,因此内部发布不受影响。 -->
<profile>
<id>central</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>

View file

@ -27,5 +27,6 @@
</xsl:template> </xsl:template>
<xsl:template match="/m:project/m:properties/m:revision" /> <xsl:template match="/m:project/m:properties/m:revision" />
<xsl:template match="/m:project/m:properties/m:main.basedir" /> <xsl:template match="/m:project/m:properties/m:main.basedir" />
<xsl:template match="/m:project/m:distributionManagement" /> <!-- 保留 distributionManagement:deploy 使用的是本文件的产物,
删除后本模块自身将无法发布到远程仓库(子模块也会因找不到 parent 而失败) -->
</xsl:stylesheet> </xsl:stylesheet>