将Java Spring引导Jar部署到Maven central
我已经开发了一个用于多模块JavaSpring启动项目的jar库,但现在我想把它上传到Maven中央存储库 为此,我创建了一个新项目,其中只包含我的库,我将其调整为可构建的库,然后将其发布到Github存储库中 然后我按照这篇文章将其部署到Maven,但没有成功,因为在使用将Java Spring引导Jar部署到Maven central,java,spring,spring-boot,maven,sonatype,Java,Spring,Spring Boot,Maven,Sonatype,我已经开发了一个用于多模块JavaSpring启动项目的jar库,但现在我想把它上传到Maven中央存储库 为此,我创建了一个新项目,其中只包含我的库,我将其调整为可构建的库,然后将其发布到Github存储库中 然后我按照这篇文章将其部署到Maven,但没有成功,因为在使用mvn clean deploy时出现了401禁止错误 以下是IntelliJ引发的完整错误: [ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging
mvn clean deploy
时出现了401禁止
错误
以下是IntelliJ引发的完整错误:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project okta-connector: Failed to deploy artifacts: Could not transfer artifact io.github.lyvoc:okta-connector:jar.asc:javadoc:1.0-20210427.100037-1 from/to ossrh (https://oss.sonatype.org/cont
ent/repositories/snapshots): Transfer failed for https://oss.sonatype.org/content/repositories/snapshots/io/github/my_user/project-connector/1.0-SNAPSHOT/project-connector-1.0-20210427.100037-1-javadoc.jar.asc 401 Unauthorized -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
以下是我的pom.xml:
4.0.0
org.sonatype.oss
oss父级
9
io.github.my_用户
项目连接器
1.0-快照
项目连接器
项目API连接器
罐子
1.8
2.4.4
org.springframework.boot
SpringBootStarterWeb
${spring启动程序版本}
org.springframework.boot
弹簧起动试验
${spring启动程序版本}
测试
javax.servlet
javax.servlet-api
3.1.0
假如
log4j
log4j
1.2.17
编译
ossrh
https://oss.sonatype.org/content/repositories/snapshots
ossrh
https://oss.sonatype.org/service/local/staging/deploy/maven2/
org.apache.maven.plugins
maven源插件
2.2.1
附加来源
罐子没有叉子
org.apache.maven.plugins
maven javadoc插件
2.9.1
附加javadocs
罐子
org.apache.maven.plugins
maven gpg插件
1.5
符号伪影
验证
签名
org.sonatype.plugins
NexusMaven插件
1.6.7
真的
ossrh
https://oss.sonatype.org/
真的
My.m2/settings.xml:
${user.home}/.m2/存储库
真的
假的
ossrh
sonatype\u用户名
我的密码
ossrh
真的
gpg
我的密码
我使用gpg而不是gpg2作为公钥,因为我安装了这个
我找不到问题的来源,因为我发现的类似情况只是使用了错误的密码或忘记为工件版本放置-SNAPSHOT
谢谢你的帮助 首先读这篇文章:第二篇为快照/发布报告使用不同的id我已经看过了。我看不出我的设置有什么问题,我用的是正确的Id
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>
<groupId>io.github.my_user</groupId>
<artifactId>project-connector</artifactId>
<version>1.0-SNAPSHOT</version>
<name>project-connector</name>
<description>Project API connector</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<spring-boot-starter-version>2.4.4</spring-boot-starter-version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-starter-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot-starter-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<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>
<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>
<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>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<servers>
<server>
<id>ossrh</id>
<username>sonatype_username</username>
<password>my_password</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>my_password</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>