惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - 何随风

安装JAVA 商业模式画布 Valve新员工手册中文版 Failure is not fatal, but failure to change might be. 降低依赖重复的两项优化 IntelliJ IDEA 我的配置--留个脚印 MSSQL大数据量增加字段耗时对比 Maven更新子模块的版本号 qq centos下安装ZooKeeper centos下配置java环境变量 vbox导入虚拟电脑网卡MAC问题 Linux下连接MSSQL之安装FreeTDS 独特的方法看问题 未来八种人将被社会淘汰 分析学习MYSQL源代码需要哪些方面的知识呢? 一个分号引发的思考 读到的"关于授权" 网站一开启网站访问硬盘读取就变慢
Maven更新父子模块的版本号
何随风 · 2016-07-12 · via 博客园 - 何随风

前置条件:

1.安装有吃饭的家伙JAVA和MAVEN.

首先,需要有一个packaging类型为pom的pom.xml文件即我们的parent项目pom文件.在这个parent项目中配置好groupId,artifactId,version以及properties,prerequisites,dependencies.

还有一个重要的配置项是modules.加入了这个项目之后执行maven版本号更新时才会同时去更新子模块的版本号.

子模块改变的部分:

<parent>
    <groupId>com.hlf</groupId>
    <artifactId>common-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.hlf</groupId>
<artifactId>projectA</artifactId>

发现没有,在这里只放了父模块的version没有放子模块的.

这时我们执行:

>mvn versions:set -DnewVersion=0.0.2-SNAPSHOT

会发现在父模块和子模块下面都生成maven的版本控制文件(姑且这么叫吧,虽然看起来就是一个文件备份)pom.xml.versionsBackup.

同时,父模块和子模块的verion都更新为了0.0.2-SNAPSHOT.

<parent>
    <groupId>com.hlf</groupId>
    <artifactId>common-parent</artifactId>
    <version>0.0.2-SNAPSHOT</version>
</parent>
<groupId>com.hlf</groupId>
<artifactId>projectA</artifactId>

到这里已经完成了子模块的版本号更新.

什么?还有?那就再加一个命令吧

>mvn versions:update-child-modules

完成!