几个关键网址
- 注册或者登录sonatype地址 :https://issues.sonatype.org/secure/Dashboard.jspa
- Gpg下载地址:https://www.gnupg.org/download/index.html
- 发布暂存包查看处:https://oss.sonatype.org
Group Id
注意
- 如果group id 的前面几位比如
cn.fook
那么前提是fook.cn
是你自己的域名,否则不要使用,如果有自己的域名,eg:blog.wangsrbus.cn
,那你的前缀就可以是cn.blog.wangsrbus
- 最好使用github的地址,会有提示比如
io.github.wangsrgit119.###
开头,审核方便通过
gpg密钥发布到服务器地址(两个地址都要发布)
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys 自己的指纹
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 自己的指纹
gpg --keyserver hkp://keyserver.ubuntu.com:11371 --send-keys 自己的指纹
gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 自己的指纹
maven-gpg-plugin 版本(1.5)
<!-- 必须配置GPG插件用于使用以下配置对组件进行签名 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
idea中发布如果不弹出gpg密码框则到cmd窗口执行mvn clean deploy
其他具体发布配置请参考百度谷歌。
我的pom配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.wangsrgit119.random.util</groupId>
<artifactId>suc-all-random</artifactId>
<version>1.0.0</version>
<name>suc-all-random</name>
<description>快捷生成用户基础信息</description>
<url>https://github.com/wangsrGit119/suc-all-random</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- 许可证信息 -->
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<!-- 开发者信息 wangjianlong-->
<developers>
<developer>
<name>wangjianlong</name>
<email>1215618342@qq.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/wangsrGit119/suc-all-random.git</connection>
<developerConnection>scm:git:https://github.com/wangsrGit119/suc-all-random.git</developerConnection>
<url>https://github.com/wangsrGit119/suc-all-random</url>
</scm>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- source 文件生成配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- javadoc 文件生成配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 配置GPG插件用于使用以下配置对组件进行签名 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- snapshotRepository 与 repository 中的 id 要与 setting.xml 中 server 的 id 保持一致 -->
<distributionManagement>
<snapshotRepository>
<id>oss</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>oss</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
本地maven增加
<server>
<id>oss</id>
<username>1215618342@qq.com</username>
<password>isoSUC110G#/</password>
</server>
评论区