发布jar包到远端github仓库使用(将github仓库当作maven仓库)
2024-09-07 08:20:57
今天把单点登陆的core模块搬到了github仓库 并且利用github仓库作为maven仓库 在项目中进行了引用
1. 起初看技术博客没有完全引入进来,调整了一下OK了
2. 还可以将其他模块或者工具类,常用的类,自己用的类发布到GitHub仓库 作为maven依赖
maven部署的插件,部署本地:
<!--github上传插件,用于修改后的发布,执行mvn clean deploy自动打包上传到github-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${repository.directory}/web-sso-core</altDeploymentRepository>
</configuration>
</plugin>
使用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.artifactId}-${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${repository.directory}/web-sso-core</outputDirectory>
<branch>refs/heads/master</branch>
<merge>true</merge>
<includes>
<include>**/*</include>
</includes>
<repositoryName>web-sso-core</repositoryName>
<repositoryOwner>deadzq</repositoryOwner>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
同样是使用mvn clean deploy.
配置文件,repository.directory是项目的根路径,在另一个地方指定模块的文件夹名: 如上面的插件的web-sso-core
<properties>
<java.version>1.8</java.version>
<jedis.version>3.0.0</jedis.version>
<github.global.server>github</github.global.server>
<repository.directory>C:\Users\ukyo\Documents\</repository.directory>
</properties>
需要开放本地maven仓库的,设定用户名密码:
settings.xml:
server标签:
<server>
<id>github</id>
<username>yourgithubloginname</username>
<password>yourpassword</password>
</server>
注意整个配置中的id应该相同.
另一边,在项目中去使用时,需要配置github仓库: 二级标签 (一级标签project)
<repositories>
<repository>
<id>github</id>
<url>https://raw.github.com/deadzq/web-sso-core/master</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
其中里面的url获取方式为,找到你发布好的github的模块,前面加二级域名raw. 后面加 /master ,假如你是发布到master分支的话.
最后加入这个模块即可:
<dependency>
<groupId>com.sso</groupId>
<artifactId>web-sso-core</artifactId>
<version>1.0.0</version>
</dependency>
正常引入:
其他资料:
最新文章
- [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.
- 格式化namenode,造成无法启动datanode
- UNIX/Linux打包,压缩 ,解压:
- Enum 绑定到 RadioButton
- MySQL约束
- ExecutorService(转)
- CentOS7安装Puppet+GitLab+Bind
- 深入浅出hive-hive简介
- CSS选择符详解之关系选择符篇
- UrlDownloadFile, 线程下载文件, 带进度条
- javascript每日一练(十二)——运动框架
- 为 ngui TweenPosition 添加 pingpongone
- python基础3--函数
- Kafka设计解析(七)- Kafka Stream
- Burp Scanner Report
- TensorFlow函数:tf.lin_space
- [Jedis] ERR wrong number of arguments for &#39;mget&#39;
- Blender的单位:一图弄懂Blender的单位
- oracle修改字符集方法
- OEM-ODM-OBM