settings配置(如果设置后有问题,可以重启idea,保证重新加载settings文件):

<!-- 上传jar包到maven中央仓库配置start -->
<server>
<id>ossrh</id>
<username>*****</username>
<password>****</password>
</server>
<!-- 上传jar包到maven中央仓库配置end -->

pom主要配置如下:  
<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>com.github.z-pro</groupId>
<artifactId>dztools</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging> <name>${project.groupId}:${project.artifactId}</name>
<description>The test uploads the jar to the maven central repository</description>
<url>https://github.com/z-pro/OSSRH-52405</url> <properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip>
</properties> <dependencies>
<!-- ... -->
</dependencies> <!-- 许可证信息 -->
<licenses>
<!-- Apache许可证 -->
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
<!-- MIT许可证 -->
<!-- <license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>-->
</licenses>
<!-- SCM信息 -> git在github上托管 -->
<scm>
<connection>scm:git:git://github.com/z-pro/OSSRH-52405.git</connection>
<developerConnection>scm:git:ssh://github.com/z-pro/OSSRH-52405.git</developerConnection>
<url>https://github.com/z-pro/OSSRH-52405/tree/master</url>
</scm>
<!-- 开发者信息 -->
<developers>
<developer>
<name>z-pro</name>
<email>380368126@qq.com</email>
<url>https://github.com/z-pro</url>
</developer>
</developers> <!-- 使用个人资料:由于生成javadoc和源jar以及使用GPG签署组件是一个相当耗时的过程,因此这些执行通常与正常的构建配置隔离并移动到配置文件中。然后,在通过激活配置文件执行部署时,将使用此配置文件。 -->
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<!-- <properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>****</gpg.passphrase>
<gpg.executable>D:\***\Gpg4win\bin\gpg.exe</gpg.executable>
<gpg.homedir>C:/Users/***/AppData/Roaming/gnupg/</gpg.homedir>
</properties>-->
<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>
<!-- 要生成Javadoc和Source jar文件,您必须配置javadoc和源Maven插件 -->
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</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>
<aggregate>true</aggregate>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<additionalparam>-Xdoclint:none</additionalparam>
</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>-->
<!-- <plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>--> </plugins>
</build>
<!-- 【注】snapshotRepository 与 repository 中的 id 一定要与 setting.xml 中 server 的 id 保持一致! -->
<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>
</profile>
</profiles>
</project>

参考:https://blog.csdn.net/qq_38225558/article/details/94381467

https://central.sonatype.org/pages/apache-maven.html#gpg-signed-components

https://www.jianshu.com/p/1bd36edab4ee

https://blog.csdn.net/alinyua/article/details/83687250

提交:https://oss.sonatype.org

搜索上线:https://search.maven.org/

maven插件上传本地jar包到maven中央仓库的更多相关文章

  1. eclipse中maven插件上传项目jar包到私服

    我们知道,每一个公司都会有自己的工具包或公共包.这样的包就能够上传到公司的maven私服,就不用每一个人都去同步开发包了. 那么,怎么把本地项目打包并公布到私服呢?依照例如以下步骤就能够轻松完毕. 1 ...

  2. 上传本地Jar包到阿里云的云效私有仓库

    一.前言 前2天玩了一下上传本地jar到maven中央仓库,随后我们老大又给我说了一个叫云效的私有仓库也可以玩,小编试了一下,果然很舒服,配置很简单,效率很高,几分钟就能搞定,只需要自己有个阿里云的账 ...

  3. 【Maven】2.使用Nexus3搭建Maven私服+上传第三方jar包到本地maven仓库

    参考文章: http://www.cnblogs.com/luotaoyeah/p/3791966.html --------------------------------------------- ...

  4. 使用Nexus3搭建Maven私服+上传第三方jar包到本地maven仓库

    1.搭建Maven私服背景 公司还是按捺不住,要搭建一个自己的Maven本地仓库,可以让开发人员down架包,从内网还是快很多. 这样公司的maven本地仓库就是 开发人员自己电脑上的maven仓库 ...

  5. maven上传本地jar包到私服

    场景 1. 本地jar包上传到私服 思路: 1. maven的settting.xml配置私服的帐号密码 2. pom.xml配置上传的地址 3. 执行 mvn deploy 部署jar包到私服 步骤 ...

  6. maven无法加载本地jar包以及maven项目打包后本地jar包没有打进项目的问题解决办法

    1.首先设置依赖项,这样maven就会把该路径下的jar包导入项目引用 <dependency> <groupId>DPSDK-Manager</groupId> ...

  7. 上传第三方jar包至maven私服,以geotools为例

    上传jar包(模块打包方式为jar) mvn deploy:deploy-file -DgroupId=org.geotools -DartifactId=gt-api -Dversion=10.3 ...

  8. Nexus-在项目中使用Maven私服,Deploy到私服、上传第三方jar包、在项目中使用私服jar包

    场景 Ubuntu Server 上使用Docker Compose 部署Nexus(图文教程): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/ ...

  9. CentOS安装Nexus(Maven私有库)详细配置及上传本地jar到私服

    Nexus原理 Maven的原理就是将jar从远程中央仓库下载到PC磁盘的本地仓库,当本地仓库没有发现需要的jar就会去Maven默认的远程中央仓库Maven Central(由Apache维护)中寻 ...

随机推荐

  1. 【前端开发】nrm切换淘宝镜像&nvm管理node版本及切换

    说明:nrm是切换淘宝镜像用的,nvm是node的版本切换用的(可在自己电脑安装多个版本node,便于不同项目的支持) 一.nrm的安装及常见命令: 安装nrmnpm install -g nrm 查 ...

  2. echart——关系图graph详解

    VueEchart组件见上一篇 <template> <VueEcharts :options="options" auto-resize /> </ ...

  3. c# 接口实现

  4. c# 虚属性

  5. Python面向对象Day1

    一.面向对象初始 面向过程变成属于流水式 面向对象是一种思想 结构上理解面向对象:两部分 class A: # 类 name = '小明' # 静态属性,静态变量,静态字段,或者属性.变量.字段 de ...

  6. Bash基础——printf

    简介 printf将参数插入到用户定义的文本字符串中,从而创建格式化的输出.printf将格式化的字符串输出到标准输出.printf命令根源是C语言下面的printf函数,就连名字都一样,很多用法也是 ...

  7. C实现哈希表

    1 哈希表原理 这里不讲高深理论,只说直观感受.哈希表的目的就是为了根据数据的部分内容(关键字),直接计算出存放完整数据的内存地址. 试想一下,如果从链表中根据关键字查找一个元素,那么就需要遍历才能得 ...

  8. 第五次个人作业---Alpha2项目测试

    这个课程属于哪个课程 <课程的链接> 作业的要求 <作业要求的链接> 团队名称 <团队名称:六扇门编程团队> 作业的目标 从一个普通用户的角度,在测试其他团队项目的 ...

  9. HTTP/TCP/IP UDP Socket等区别联系

    1.TCP连接 手机能够使用联网功能是因为手机底层实现了TCP/IP协议,可以使手机终端通过无线网络建立TCP连接.TCP协议可以对上层网络提供接口,使上层网络数据的传输建立在“无差别”的网络之上. ...

  10. 阿里云 centos7 安装mysql数据库

    环境:阿里云ECS服务器,系统为centos7.2 删除原来的数据库: centos7中默认安装了数据库MariaDB,如果直接安装MySQL的话,会直接覆盖掉这个数据库,当然也可以手动删除一下: [ ...