注册账号和生成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. P7213 [JOISC2020] 最古の遺跡 3 乱写

    不想写题解了,把写在草稿纸上的东西整理了一下 感谢 crashed 大佬的题解与对本人问题的回答,没有他我就不会搞懂这道神仙计数题.

  2. smart rtmpd 服务器配置文件说明及优化方法介绍

    ---------------------------------------------------------------------------------------------------- ...

  3. Android开发踩坑日记

    ViewModelProviders被弃用,改为ViewModelProvider ViewModelProvider使用方法 MyViewModel model = new ViewModelPro ...

  4. react组件之非受控组件和高阶组件

    非受控组件 受控组件和非受控组件的区别 ----- value import React, { Component } from 'react' export default class extend ...

  5. 项目讲解之火爆全网的开源后台管理系统RuoYi

    博主是在2018年中就接触了 RuoYi 项目 这个项目,对于当时国内的开源后台管理系统来说,RuoYi 算是一个完成度较高,易读易懂.界面简洁美观的前后端不分离项目. 对于当时刚入行还在写 jsp ...

  6. python之re详解

    import re# .匹配任何一个字符,除了换行#[]匹配里面任意一个字符# \d匹配一个数字0-9# \D匹配不是一个数字# \s 匹配一个空格和tab# \S 匹配非空格和tab一个字符# \w ...

  7. MySQL(六)存储引擎

    存储引擎 ​ 连接管理.查询缓存.解析器和执行器被归为MySQL service,而把真实存储数据的功能划分为存储引擎的功能.所以MySQL service经过查询优化后,只需按照生成的执行计划调用存 ...

  8. 【Spring】SpringSecurity的使用

    4 SpringSecurity 只需要协助SpringSecurity创建好用户对应的角色和权限组,同时把各个资源所要求的权限信息设定好,剩下的像 "登录验证"."权限 ...

  9. LNMP搭建静态网页服务器

    chattr -i default/.user.ini LNMP搭建使用 1.安装screen,命令或者操作可以一直运行下去 yum install screen 2.获取及安装 LNMP wget ...

  10. SRAM 测试总结

    SoC随着工艺进步设计复杂度增加,embeded sram也越来越多.在40nm SoC产品Sram一般在20Mbits左右,当工艺发展到28nm时Sram就增加到100Mbits.如果考虑AI产品, ...