注册账号和生成GPG生成密钥教程

主要看注册账号和生成GPG密匙部分就行了,出现问题可以先在这两个地方找

gpg加密发布jar包到maven中央仓库详细过程以及踩的坑_佛系猿秦大昊的博客-CSDN博客

来开源吧!发布开源组件到 MavenCentral 仓库超详细攻略 - 掘金 (juejin.cn)

1. 修改Maven配置文件

全局配置文件添加

	<server>
<id>sonatype-qimu</id>
<username>sonatype账号</username>
<password>密码</password>
</server>

2. 修改项目pom,xml

在Maven项目的pom.xml中添加licenses、developers、scm、profiles、plugins、distributionManagement等内容,示例:

<?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.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>icu.qimuu</groupId>
<artifactId>EazyWeb</artifactId>
<version>0.0.1</version>
<name>EazyWeb</name>
<description>EazyWeb</description> <properties>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses> <!-- 根据自己实际情况填写 -->
<developers>
<developer>
<name>qimu</name>
<email>2483482026@qq.com</email>
</developer>
</developers> <!-- 与申请issue时填写的SCM保持一致 -->
<scm>
<connection>https://github.com/qimu666/EazyWeb.git</connection>
<developerConnection>https://github.com/qimu666/EazyWeb.git</developerConnection>
<url>https://github.com/qimu666/EazyWeb</url>
</scm> <profiles>
<profile>
<!-- 这个id就是打包时的 -P 参数 -->
<id>release</id>
<build>
<plugins>
<!-- Source插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<!-- -Xdoclint:none 是为了避免生成apidoc的时候检查过于严格而报错-->
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<!-- GPG加密插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> <!-- snapshotRepository与repository的id应与setting.xml中添加的server的id一致 -->
<distributionManagement>
<snapshotRepository>
<id>sonatype-qimu</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-qimu</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

3. 控制台执行命令

mvn clean deploy -P release

发布自己的项目到Maven中央仓库中的更多相关文章

  1. Maven系列(十)发布自己的项目到 Maven 中央仓库

    Maven 发布自己的项目到 Maven 中央仓库 可能很多人都在用 Maven 仓库,但是如果要问怎么发布项目到中央仓库,估计很多人都不知道了,下面本篇文章带大家往中央仓库发布一个自己的 Maven ...

  2. 发布项目到maven中央仓库

    https://www.xiaominfo.com/2017/04/25/swagger-bootstrap-ui-issue-maven-central/?tdsourcetag=s_pcqq_ai ...

  3. Maven中央仓库正式成为Oracle官方JDBC驱动程序组件分发中心

    1. 前言 相信参与使用Oracle数据库进行项目开发.运维的同学常常被Oracle JDBC驱动的Maven依赖折磨.现在这一情况在今年二月份得到了改变,甲骨文这个老顽固终于开窍了. 一位甲骨文的工 ...

  4. 贡献你的代码,将jar包发布到Maven中央仓库以及常见错误的解决办法

    前几天将自己的日志工具发布到了Maven中央仓库中.这个工具本省没有多少技术含量,因为是修改别人的源代码实现的,但是将jar发布到Maven仓库却收获颇丰,因为网上有些教程过时了,在此分享下自己发布j ...

  5. 如何发布jar包到maven中央仓库

    自使用maven以来,没少使用maven中央仓库中的各种jar包,方便有效,但是咱们也不能总是只取不予,也应该懂得奉献,当你写好了一个十分好用的jar包,想贡献出去给大家使用的时候,应该怎么做呢?当然 ...

  6. 如何将自己的代码发布到Maven中央仓库?

    去年在公司做工作流相关业务时,当时使用flowable做引擎,中途涉及到一些业务上的需求,自己整理了一些代码,考虑到开源精神,当时就想着将于公司业务无关的代码抽离出来,放到Maven中央仓库中,以供别 ...

  7. 发布Jar包到maven中央仓库

    什么是maven中央仓库 maven是java世界最流行的构建工具,构建内容囊括了一个java项目的整个生命周期.其中最重要的功能就是依赖管理,maven通过一个类似云的ftp站点统一管理所有java ...

  8. 上传自己的构件(Jar)到Maven中央仓库

    背景: 用了Maven之后,你有没有这样的想法,自己一直在使用别人贡献的代码,自己能不能把自己觉得好的代码也贡献出来让大家方便. 还有如果你也是一名程序员,你会不会觉得要是把自己积累起来日常常用的代码 ...

  9. Maven——向Maven本地仓库中手动添加依赖包(ps:ojdbc.jar)

    maven中央仓库中并非包含所有现有的依赖包和插件,部分依赖包和插件需要手动地进行添加(如ojdbc.jar) 一.添加JDK系统环境变量(maven是基于Java的,可参考:https://www. ...

  10. 将项目发布到Maven中央仓库的不完整纪要

    背景 有几个Utils性质的Jar需要跨项目引用,原本想部署私有Maven仓库,后来感觉太麻烦,索性直接发布到中央库,引用时也方便. 发布成功之后,觉得某些细节还是有必要记录一下. 资源 Sonaty ...

随机推荐

  1. Teamcenter_NX集成开发:使用NX、SOA连接Teamcenter

    最近工作中经常使用Teamcenter.NX集成开发的情况,因此在这里记录使用NX.SOA连接到Teamcenter的连接方式. 主要操作: 1-初始化UGMGR环境成功后就可以连接到Teamcent ...

  2. selenium验证码处理-打码平台操作

    1.进入打码平台(超人,斐斐) 斐斐-------官网: 超人-------官网: 2.选择对应的开发文档,下载对应的demo示例,并把demo的python脚本放到项目包管理地址去 参考: 超人的开 ...

  3. Bean的自动装配(Autowired)

    Bean的自动装配(Autowired) 自动装配是Spring满足bean依赖的一种方式 Spring会在上下文中自动寻找,并自动给bean装配属性 在Spring中有三种自动装配的方式 在xml中 ...

  4. 经GitHub将kubernetes镜像推送到阿里云

    背景 在安装kubernetes时会出现无法访问镜像站的情况,通过GitHub将kubernetes镜像推送到阿里云之后,即可使用阿里云地址引用所需镜像,现已同步镜像5000+,当前还在陆续同步.仓库 ...

  5. [数据库/MYSQL]MYSQL开启Bin-Log

    1 概述: MYSQL数据库的二进制日志----bin log 什么是二进制日志(binlog)? MySQL的二进制日志binlog,可以说是MySQL最重要的日志,它记录了所有的DDL和DML语句 ...

  6. Luogu P4114 Qtree1

    树剖一好题.我心水了ww 题目描述 给定一棵n个节点的树,有两个操作: CHANGE i ti 把第i条边的边权变成ti QUERY a b 输出从a到b的路径中最大的边权,当a=b的时候,输出0 输 ...

  7. Android开发_记事本(1)

    一些知识 Textview TextView中有下述几个属性: id:为TextView设置一个组件id,根据id,我们可以在Java代码中通过findViewById()的方法获取到该对象,然后进行 ...

  8. Arnold置乱

    一.Arnold置乱概述 Arnold变换是俄国数学家弗拉基米尔·阿诺德(Vladimir Igorevich Arnold)提出,Arnold将其应用在遍历理论研究中.由于Arnold本人最初对一张 ...

  9. 【有问必答】搭建uniapp项目流程手把手教学

    前言 缘由 博友有问,狗哥必答 前段时间,博友加本狗微信,询问uniapp的学习方法.本狗资历浅薄,没有专门学过uniapp,只能将自己日常开发uniapp的基本流程和步骤进行分享,希望可以略尽绵薄之 ...

  10. Centos7.x 安装Chrome + Chrome driver

    一.安装Chrome 1.执行下面命令进行安装操作 yum install https://dl.google.com/linux/direct/google-chrome-stable_curren ...