目录
5.7 发送公钥异常:gpg: keyserver send failed: Unknown error
Sign up for Jira - Sonatype JIRA
新建后,等待工作人员评论
如果评论这样的话,在github上创建一个对应空项目。
这样就是认证通过了,可以上传项目到中央仓库。
在
-
- <server>
- <id>ossrhid>
- <username>你sonatype账号username>
- <password>sonatype 密码password>
- server>
- <name>object-comparatorname>
- <description>Java object property value comparatordescription>
- <url>https://github.com/jinchunzhao/object-comparatorurl>
-
- <developers>
- <developer>
- <id>jinchunzhaoid>
- <name>jinchunzhaoname>
- <email>15136708953@163.comemail>
- developer>
- developers>
根据项目的开源协议
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txturl>
- license>
- licenses>
- <scm>
- <connection>https://github.com/jinchunzhao/object-comparator.gitconnection>
- <url>https://github.com/jinchunzhao/object-comparatorurl>
- scm>
distributionManagement 下面的id必须要和你 maven settings.xml里面的id配置的一模一样
- <profiles>
- <profile>
- <id>releaseid>
- <activation>
- <activeByDefault>trueactiveByDefault>
- activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-source-pluginartifactId>
- <version>2.2.1version>
- <executions>
- <execution>
- <phase>packagephase>
- <goals>
- <goal>jar-no-forkgoal>
- goals>
- execution>
- executions>
- plugin>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-javadoc-pluginartifactId>
- <version>2.9.1version>
- <configuration>
- <show>privateshow>
- <nohelp>truenohelp>
- <charset>UTF-8charset>
- <encoding>UTF-8encoding>
- <docencoding>UTF-8docencoding>
- <additionalparam>-Xdoclint:noneadditionalparam>
- configuration>
- <executions>
- <execution>
- <phase>packagephase>
- <goals>
- <goal>jargoal>
- goals>
- execution>
- executions>
- plugin>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-gpg-pluginartifactId>
- <version>1.6version>
- <executions>
- <execution>
- <phase>verifyphase>
- <goals>
- <goal>signgoal>
- goals>
- execution>
- executions>
- plugin>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-compiler-pluginartifactId>
- <version>3.7.0version>
- <configuration>
- <source>1.8source>
- <target>1.8target>
- configuration>
- plugin>
-
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-release-pluginartifactId>
- <version>2.5.1version>
- plugin>
- <plugin>
- <artifactId>maven-deploy-pluginartifactId>
- <version>2.8.2version>
- <executions>
- <execution>
- <id>default-deployid>
- <phase>deployphase>
- <goals>
- <goal>deploygoal>
- goals>
- execution>
- executions>
- plugin>
- <plugin>
- <groupId>org.sonatype.pluginsgroupId>
- <artifactId>nexus-staging-maven-pluginartifactId>
- <version>1.6.7version>
- <extensions>trueextensions>
- <configuration>
- <serverId>ossrhserverId>
- <nexusUrl>https://s01.oss.sonatype.org/nexusUrl>
- <autoReleaseAfterClose>trueautoReleaseAfterClose>
- configuration>
- plugin>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-scm-pluginartifactId>
- <version>1.8.1version>
- plugin>
- plugins>
- build>
-
- <distributionManagement>
- <snapshotRepository>
- <id>ossrhid>
- <name>Sonatype Nexus Snapshotsname>
- <url>https://s01.oss.sonatype.org/content/repositories/snapshots/url>
- snapshotRepository>
- <repository>
- <id>ossrhid>
- <name>Nexus Release Repositoryname>
- <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/url>
- repository>
- distributionManagement>
- profile>
- profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-compiler-pluginartifactId>
- <configuration>
- <source>8source>
- <target>8target>
- configuration>
- plugin>
- plugins>
- build>
傻瓜式安装
ggp --version
gpg --list-keys
gpg --keyserver hkp://keyserver.ubuntu.com:11371 --send-keys 刚刚生成的公钥
gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 刚刚发送的公钥
适用我的解决办法是:
执行下面两个命令
- gpgconf --kill dirmngr
-
- dirmngr --debug-all --daemon --standard-resolver
在另一个终端上运行推送公钥命令就可以了。
mvn clean deploy -P release -Dmaven.test.skip=true
- # 这里的 -P release与pom.xml中的标签一致
- <profile>
- <id>releaseid>
- profile>
执行成功
表明已经发布成功了。
这样就可以到 Maven Central Repository Search 去查刚刚发布的项目,如果没有查到也关系,同步需要一段时间。