mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
70 lines
1.6 KiB
Markdown
70 lines
1.6 KiB
Markdown
|
## 🔒注册中央库账号
|
|||
|
|
|||
|
### 1. 注册
|
|||
|
https://central.sonatype.com/
|
|||
|
|
|||
|
### 2. 新增域名空间
|
|||
|
https://central.sonatype.com/publishing/namespaces
|
|||
|
|
|||
|
### 3. 生成用户Token
|
|||
|
https://central.sonatype.com/account
|
|||
|
点击`Generate User Token`
|
|||
|
|
|||
|
## ⚙️配置本地Maven
|
|||
|
|
|||
|
### 1.安装Maven
|
|||
|
https://maven.apache.org/install.html
|
|||
|
下载解压到本地,配置Path
|
|||
|
```
|
|||
|
M2_HOME : <安装目录>
|
|||
|
path : %M2_HOME%\bin
|
|||
|
```
|
|||
|
### 2.修改settings.xml
|
|||
|
打开`maven目录`/conf/settings.xml
|
|||
|
在`servers`标签下增加:
|
|||
|
```xml
|
|||
|
<server>
|
|||
|
<id>central</id>
|
|||
|
<username>中央库生成的token中的用户名</username>
|
|||
|
<password>中央库生成的token中的密码</password>
|
|||
|
</server>
|
|||
|
```
|
|||
|
### 3. 修改项目pom.xml中的配置
|
|||
|
使用Maven发布插件:
|
|||
|
```xml
|
|||
|
<plugin>
|
|||
|
<groupId>org.sonatype.central</groupId>
|
|||
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
|||
|
<version>0.6.0</version>
|
|||
|
<extensions>true</extensions>
|
|||
|
<configuration>
|
|||
|
<publishingServerId>central</publishingServerId>
|
|||
|
<!-- 自动发布 -->
|
|||
|
<autoPublish>true</autoPublish>
|
|||
|
<!-- 等待发布 -->
|
|||
|
<waitUntil>published</waitUntil>
|
|||
|
</configuration>
|
|||
|
</plugin>
|
|||
|
```
|
|||
|
|
|||
|
> 注意:`publishingServerId`必须与`settings.xml`中的`id`一致。
|
|||
|
|
|||
|
## 📤发布
|
|||
|
|
|||
|
### 1. 更新版本
|
|||
|
```shell
|
|||
|
bin/update_version.sh 新版本号
|
|||
|
```
|
|||
|
### 2. 本地安装验证
|
|||
|
执行以下命令会编译、打包、并安装到本地库中,以验证所有单元测试、代码编译无误。
|
|||
|
```shell
|
|||
|
bin/install.sh
|
|||
|
```
|
|||
|
### 3. 发布
|
|||
|
执行以下命令会编译、打包、并上传到中央库,以验证所有单元测试、代码编译无误。
|
|||
|
```shell
|
|||
|
bin/deploy.sh
|
|||
|
```
|
|||
|
|
|||
|
### 4. 查看发布情况
|
|||
|
https://central.sonatype.com/publishing
|