发布jar 到maven中央仓库 ,上传包到maven

一、注册账号

https://issues.sonatype.org

通过上面地方注册账号

二、提交工单

登录成功后,会显示此界面。选择创建

填写基本信息:group id一定要写正确,真实存在,因为这个我就提交了两次

保存等他们客服回复。

三、收到邮件后,是否通过,不通过根据情况修改。

收到此邮件表示成功了。

四、上传jar包

maven setttings.xml

<server>
        <id>sonatype-nexus-snapshots</id>
        <username>账号</username>
        <password>密码</password>
    </server>
    <server>
        <id>sonatype-nexus-staging</id>
        <username>账号</username>
        <password>密码</password>
    </server>

pom.xml 配置

<parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

<scm>
    <connection>scm:git:[email protected]:oufu/ofcms.git</connection>
    <developerConnection>scm:git:[email protected]:oufu/ofcms.git</developerConnection>
    <url>[email protected]:oufu/ofcms.git</url>
  </scm>

<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>

clean package deploy  命令上传

五、查看结果

登录 https://oss.sonatype.org/#stagingRepositories

 

一般过10分钟就可查询的到。

猜你喜欢

转载自blog.csdn.net/oufua/article/details/81506254