github~通过packages功能实现maven仓库托管
github在被大微软收购之后,推出了很多非常不错的功能,这一次把很多仓库管理合并到一起了,包括了nuget,npm,maven,docker等等,今天我们把java代码推到github的maven仓库吧!
申请一个github token
建立一个仓库,起名为maven_repo
配置你的.m2/settings.xml文件
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/bfyxzls/maven_repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>bfyxzls@sina.com</username>
<password>刚才生成的token在这里就不泄漏了</password>
</server>
</servers>
</settings>
在项目pom.xml里指定它,发布者和使用者都需要配置
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/bfyxzls/maven_repo</url>
</repository>
</distributionManagement>
发布你的包到github packages
mvn deploy
你最终发布的包在这里
参考文章
- https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry
- https://docs.github.com/en/packages/learn-github-packages/connecting-a-repository-to-a-package
- https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
合集:
springboot(2)
, git
分类:
Java
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
2022-04-25 springBoot~跨域后PUT,DELETE方法出现403Forbidden
2018-04-25 基础才是重中之重~内存里的堆和栈
2014-04-25 NodeJS系列~目录