将自定义jar包上传github并制作成maven仓库
参照:https://www.jianshu.com/p/98a141701cc7
第一阶段 :配置github
1、创建mvn-repo分支
首先在你的github上创建一个maven-repo-demo仓库,这个最后将作为实际上jar包发布的仓库
2、设置真实姓名
在github的个人设置中,设置好自己的姓名 。这个环节很重要,若不设置姓名,会出现一些一些意想不到的错误,如:
[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.12:site (default) on project rfcore: Error creating commit: Invalid request.
[ERROR] For 'properties/name', nil is not a string.
[ERROR] For 'properties/name', nil is not a string. (422)
[ERROR] -> [Help 1]
第二阶段:配置部署jar到本地1、 配置本地mvn服务
1、设置本地maven的配置文件settings.xml,找到其中的servers 标签,加入如下 配置:
<server>
<id>github</id>
<username>*****</username>
<password>*****</password>
</server>
2、修改pom文件发布本地仓库
在需要发布的项目中的pom文件里的 标签下加入以下插件:
然后运行 mvn clean deploy 命令,即可在对应项目中的target/repository目录下找到本地的jar
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/repository</altDeploymentRepository>
</configuration>
</plugin>
</plugins>
</build>
第三阶段:发布jar到远程github上
1、修改pom文件,在properties 中添加下列属性
<properties>
<github.global.server>github</github.global.server>
</properties>
2、添加修改插件
<build>
<plugins>
<!--打包插件-->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/repository</altDeploymentRepository>
</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>
<!--github上传插件,用于修改后的发布,执行 mvn clean deploy 自动打包上传到github-->
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version >0.12</version>
<configuration>
<message >Maven artifacts for ${project.version}</message>
<noJekyll>true</noJekyll>
<!--本地jar地址-->
<outputDirectory>${project.build.directory}/repository</outputDirectory>
<!--分支-->
<branch>refs/heads/master</branch>
<merge>true</merge>
<includes>
<include>**/*</include>
</includes>
<!--对应github上创建的仓库名称 name-->
<repositoryName>maven-repo-demo</repositoryName>
<!--github 仓库所有者 不是账号-->
<repositoryOwner>l305170891</repositoryOwner>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
再次执行 mvn clean deploy命令即可发布到github上了 。
若出现如下错误请完成第一阶段第二步配置:
[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.12:site (default) on project rfcore: Error creating commit: Invalid request.
[ERROR] For 'properties/name', nil is not a string.
[ERROR] For 'properties/name', nil is not a string. (422)
[ERROR] -> [Help 1]
第四阶段:在项目中使用发布到github上的jar包pom文件中添加github仓库
然后添加依赖即可
<dependency>
<groupId>com.luojian.github.repo.demo</groupId>
<artifactId>maven-repo-demo</artifactId>
<version>1.0.1</version>
</dependency>
将自定义jar包上传github并制作成maven仓库的更多相关文章
- 构建自己的jar包上传至Mvaen中央仓库和版本更新
构建自己的jar包上传至Mvaen中央仓库和版本更新 一直羡慕别人制造轮子,开源项目,供别人使用:我也想这样,可以自己才疏学浅,本次就将自己写小工具上传到Maven的中央仓库. 一步一步详细教程演示如 ...
- Maven中安装本地Jar包到仓库中或将本地jar包上传
摘要 maven install 本地jar 命令格式 mvn install:install-file -DgroupId=<group_name> -DartifactId=<a ...
- 用eclipse怎样将本地的项目打成jar包上传到maven仓库
使用maven的项目中,有时需要把本地的项目打成jar包上传到mevan仓库. 操作如下: 前提:pom文件中配置好远程库的地址,否则会报错 1.将maven 中的settings文件配置好用户名和密 ...
- maven jar包上传到服务器
maven jar包上传到服务器时出现pom文件没有上传上去,致使该jar包再被使用的时候没有依赖,jar包调用出错 解决办法,将pom文件一起deploy上去 mvn deploy:deploy-f ...
- nexus搭建maven私服及私服jar包上传和下载
nexus搭建maven私服及私服jar包上传和下载 标签: nexus管理maven库snapshot 2017-06-28 13:02 844人阅读 评论(0) 收藏 举报 分类: Maven(1 ...
- Apache Flink任意Jar包上传导致远程代码执行漏洞复现
0x00 简介 Apache Flink是由Apache软件基金会开发的开源流处理框架,其核心是用Java和Scala编写的分布式流数据流引擎.Flink以数据并行和流水线方式执行任意流数据程序,Fl ...
- IDEA如何将写好的java类(UDF函数)打成jar包上传linux
一.编写一个UDF函数,实现将字符串大写转小写 import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; ...
- Apache Flink Dashboard未授权访问导致任意Jar包上传漏洞
漏洞危害 攻击者无需Flink Dashboard认证,通过上传恶意jar包 csdn-[漏洞复现]Apache Flink任意Jar包上传导致远程代码执行 freebuf-Apache Flink ...
- nexus的jar包上传与下载
1. hosted,宿主仓库,部署自己的jar到这个类型的仓库,包括releases和snapshot两部分,Releases公司内部发布版本仓库. Snapshots 公司内部测试版本仓库 2. p ...
随机推荐
- 安装tomacat之后出现需要授权窗口
安装tomacat之后登录网页,出现需要授权窗口,输入正确密码后依然会循环弹出该窗口. 原因: 因为tomcat的端口与oracle的端口重复了. 解决: 进入任务管理器,然后将oracle运行的程序 ...
- 洛谷 P3605 [USACO17JAN]Promotion Counting晋升者计数
题目描述 The cows have once again tried to form a startup company, failing to remember from past experie ...
- 动手动脑---找出指定文件夹下所有包容指定字符串的txt文件
思路:先判断是否为文件,如果是文件,则需要判断改文件名是否包含字符串"txt",包含则输出.如果是文件夹的话,先需要判断文件名是否包含".txt"(因为文件名也 ...
- SpringBoot-设置定时任务
@Scheduled为设置定时任务的注解. 参数常用的为两种: 第一种是fixedRate,表示以一种固定频率去执行,单位为毫秒:例如@Scheduled(fixedRate = 5000) 表示为 ...
- BZOJ 4890: [Tjoi2017]城市 树形dp
标签:树形dp,枚举,树的直径 一上来看到这个题就慌了,只想到了 $O(n^3)$ 的做法. 碰到这种题时要一步一步冷静地去分析,观察数据范围. 首先,$n\leqslant 5000$,所以可以先 ...
- 【CPLEX教程02】配置Cplex的Java环境以及API说明
00 前言 因为小编一般用的C++和Java比较多,而且现在开发大型算法用这类面向对象的编程语言也方便得多.基于上面的种种考虑,加上时间和精力有限,所以就暂时只做C++和Java的详细教程辣.关于ma ...
- SpringBoot中Example的动态条件查询
一.无匹配器的情况: Person person = new Person(); person.setName("test"); Role role = new Role(); r ...
- git下载指定分支到本地
从网上查了很多方法有很多种,自我感觉下面这种更方便 git clone xxx.git --branch 分支名/dev/...
- Mysql 之根据经纬度按距离排序
一.方式一 st_distance 计算的结果单位是度,需要乘111195(地球半径6371000*PI/180)是将值转化为米. SELECT *, (st_distance(point(lng,l ...
- 【转】Android ROM分析(1):刷机原理及方法
一.刷机原理 android系统启动的时候,首先会进行一些诸如硬件自检之类的操作,这些操作完成以后(至少它应该知道当前的机器有没有电),会检查一下当前手机按键的状态(接下来就是所谓刷机模式切换了,不同 ...