使用github作为maven仓库发布自己的jar包依赖
来源:互联网 发布:mac网游 编辑:程序博客网 时间:2024/05/17 03:14
创建mvn-repo分支
首先在你的github上创建一个maven-repo仓库,这个最后将作为实际上jar包发布的仓库
配置本地mvn服务
找到自己计算机中本地maven配置文件settings.xml,找到其中的 标签,加入如下 配置
<server> <id>github</id> <username>github的用户名</username> <password>github的密码</password> </server>
修改pom文件发布本地仓库
在需要发布的项目中的pom文件里的 标签下加入以下插件
<plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.1</version> <configuration> <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository> </configuration></plugin>
然后运行 mvn clean deploy 命令,即可在对应项目中的target/mvn-repo目录下找到本地的jar
继续修改pom文件发布到远程github上
修改pom文件,添加属性
<properties> <github.global.server>github</github.global.server></properties>
添加修改插件
<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> <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <branch>refs/heads/master</branch> <includes> <include>**/*</include> </includes> <repositoryName>maven-repo</repositoryName> <!-- 对应github上创建的仓库名称 name --> <repositoryOwner>你的用户名</repositoryOwner> <!-- github 仓库所有者 --> </configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>deploy</phase> </execution> </executions> </plugin>
再次执行 mvn clean deploy命令即可发布到github上了
在自己的项目中使用发布的jar
pom文件中添加对应仓库
<repositories> <repository> <id>maven-repo-master</id> <url>https://raw.github.com/hwangfantasy/maven-repo/master/</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository></repositories>
然后添加依赖即可
如我自己smart-util
<dependency> <groupId>com.hwangfantasy</groupId> <artifactId>smart-util</artifactId> <version>1.0-SNAPSHOT</version> </dependency>
愉快地使用吧!
参考我自己的实现
0 0
- 使用github作为maven仓库发布自己的jar包依赖
- 向maven仓库中导自己的jar包依赖
- 如何发布自己的 jar 包到 maven 中央仓库
- 发布自己开发jar包到maven仓库
- Maven依赖的是本地工程还是仓库jar包?
- Maven依赖的是本地工程还是仓库jar包?
- eclipse tomcat 依赖maven 仓库的jar 包设置
- maven安装自己下载的jar包到本地仓库
- Maven 将自己的jar包安装到本地仓库
- maven 添加自己下载的jar包到本地仓库
- maven 发布jar包到远程仓库,
- Maven 发布jar包到远程仓库
- maven发布jar包到nexus仓库
- 发布Jar包到Maven中央仓库
- 发布jar包到Maven中央仓库
- 发布Jar包到Maven中央仓库
- maven 如何设置使用自定义的jar包到自己本地仓库
- 使用Maven管理依赖JAR文件,自定义项目布局,利用ANT生成不同的发布包
- 《C陷阱与缺陷》:更新顺序文件
- HTML CSS 特殊字符表
- 伯努利分布、二项分布、泊松分布、指数分布简介
- 安卓排除美颜相机等第三方相机直接调用系统相机处理方法
- Java NIO几个基础概念[待编辑]
- 使用github作为maven仓库发布自己的jar包依赖
- 计算机组成原理之原码、补码、反码和移码
- Lock和synchronized比较详解
- 用纯css改变下拉列表select框的默认样式
- How browsers work(浏览器工作原理)
- 《JavaScript高级程序设计 第三版》学习笔记 (二)执行环境与作用域链
- Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer c
- Ubuntu16.04安装mongodb
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)