发布/上传Jar包到Maven中央仓库

1.注册Sonatype账号

2.项目申请,创建工单

在这里插入图片描述

2.1回复

在这里插入图片描述

groupId 域名 可以使用github, io.github.账号
创建工单根据评论回复,需要创建临时仓库,验证账户所有权。

3.gpg4win 地址:https://www.gpg4win.org/download.html ,执行 gpg --gen-key 命令新建密钥对。

执行命令后输入 姓名 和 邮箱 还有 Passphase(证书密码),Passphase 需要记住,使用证书的时候会输入密码。

**********
pub  ---------
	A49F5604BF0CE123UI26E45W38AD1125DA12F4L7 
**********

gpg --keyserver hkp://keyserver.ubuntu.com:11371 --send-keys
A49F5604BF0CE123UI26E45W38AD1125DA12F4L7

4. 官方部署文档

4.1 setting.xml

<settings>
  <servers>
    <server>
      <id>ossrh</id>
      <username>your-jira-id</username>
      <password>your-jira-pwd</password>
    </server>
  </servers>
  
   <profiles>
        <profile>
	        <id>ossrh</id>
	        <activation>
	            <activeByDefault>true</activeByDefault>
	        </activation>
	        <properties>
	            <gpg.executable>gpg</gpg.executable>
	            <gpg.passphrase>A49F5604BF0CE123UI26E45W38AD1125DA12F4L7</gpg.passphrase>
	        </properties>
       </profile>
  </profiles>
</settings>

4.2 pom.xml

 	<groupId>io.github.smilexizheng</groupId>
    <artifactId>redisson-tool-spring-boot-starter</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    
    <name>redisson-tool</name>
    <description>Annotation Tool Based on Redisson Implementation</description>
    <packaging>jar</packaging>
    
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/smilexizheng/redisson-tool-spring-boot-starter</url>
        <connection>scm:git:https://github.com/smilexizheng/redisson-tool-spring-boot-starter.git</connection>
    </scm>


    <developers>
        <developer>
            <id>smilesay</id>
            <name>smilesay</name>
            <email>@qq.com</email>
            <roles>
                <role>Developer</role>
            </roles>
            <timezone>+8</timezone>
        </developer>
    </developers>
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <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://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <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>
                        <configuration>
                            <!-- jdk1.8要加上,1.7要去掉,否则会报错 -->
                            <additionalJOptions>
                                <additionalJOption>-Xdoclint:none</additionalJOption>
                            </additionalJOptions>
                        </configuration>
                        <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>
                </plugins>

            </build>
        </profile>
    </profiles>

5. 查询发布 https://s01.oss.sonatype.org/

等待maven中心仓库的同步~~

参考:
https://blog.csdn.net/qq_41973594/article/details/119791466
https://blog.csdn.net/ttzommed/article/details/114697533

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值