[转] Maven 从命令行获取项目的版本号
【From】https://blog.soebes.de/blog/2018/06/09/help-plugin/
I bet you have been faced with the situation to get the version of your Maven project on command line? So the question is how to get it? I have seen many solutions via using Linux tools like grep, cat or awk etc. also seen many solutions like using exec-maven-plugin like this:
1 |
|
Unfortunately the above approach will not work on Windows.
Starting with Maven Help Plugin Release 3.1.0 this can be done more easier like the following:
1 |
|
This will exactly print out the version of your artifact on stdout and nothing else. Also no line feed is printed out.
So this can be used easily in scripts like this:
1 |
|
If you have correctly pinned the version of your plugins in your pom file or in a parent pom of the project this can be simplified like this:
1 |
|
Apart from extracting the version you can also extract other information from the pom file like the following:
1 |
|
More sophisticated expressions like the following are possible too:
1 |
|
Posted by Karl-Heinz Marbaise Jun 9th, 2018 Maven, Maven-Plugins, Usage
[转] Maven 从命令行获取项目的版本号的更多相关文章
- Maven 命令行创建项目时 Could not find goal ‘create’ in plugin org.apache.maven.plugins:...
使用maven3.3.9 版本,进行命令行创建项目时输入以下命令创建失败 mvn archetype:create -DgroupId=com.zang.maven -DartifactId=sys ...
- maven 骨架命令行创建
项目的骨架maven 约定在项目的根目录下放置pom.xml,在src/main/java目录下放置主代码,在src/test/java下放置项目的测试代码. 这些基本的目录结构和pom.xml文件的 ...
- egret命令行编译项目时 版本不对应的问题
egret 命令行编译项目时 如使用 egret build -e 会出现版本不对应的问题 分析原因 A,B项目 A项目使用1.8的egret引擎, B项目使用2.5引擎 但本地引擎升级至2.5.5, ...
- cocos命令行生成项目
cocos命令行生成项目: cocos new GoodDay(项目名称) -p com.boleban.www(包名字) -l cpp(项目类型) -d D:\DevProject\cocos2dx ...
- Shell 命令行获取本机IP,grep的练习
Shell 命令行获取本机IP,grep的练习 在 mac 下面输入 ifconfig 或者在 linux 下面输入 ip a 就可以得到我们的网卡信息.不过通常情况下,我们需要查看的是我们的IP地址 ...
- 命令行获取docker远程仓库镜像列表
命令行获取docker远程仓库镜像列表 获取思路 通过curl获取镜像tag的json串,解析后得到${image}:${tag}的格式 curl获取示例 # curl [:-s] ${API}/${ ...
- python命令行获取参数
python命令行获取参数 import sys # python获取参数 input_file = sys.argv[1] output_file = sys.argv[2] print(input ...
- maven命令行创建项目问题
今天在命令行下创建maven项目,使用的是create命令,但是一直失败,网上查找原因说archetype:create命令已经过期,需要使用 archetype:generate 来进行代替 加上了 ...
- [深入Maven源代码]maven绑定命令行参数到具体插件
maven的插件 我们知道Maven具体构建动作都是由插件执行的,maven本身只是提供一个框架,这样就提供了高度可定制化的功能,我们用maven命令执行比如mvn clean package这样的命 ...
随机推荐
- GIT和SVN的区别(面试)
Cit是分布式,而SVN不是分布式 存储内容的时候,Git按元数据方式存储,而SVN是按文件 Git没有一个全局版本号,SVN有,目前为止这是SVN相比Git缺少的最大的一个特征 Git的内容完整性要 ...
- 【Share Code | HTML & CSS & Javascript】动画片段幻灯片
[查看demo & 下载资源](https://zhaoshuquan.com/posts/15 介绍 本文使用"Pieces"库轻松实现动画片段幻灯片效果. 今天我们想向 ...
- Luogu P4331 [BOI2004]Sequence 数字序列 (左偏树论文题)
清晰明了%%% Fairycastle的博客 个人习惯把size什么的存在左偏树结点内,这样在外面好写,在里面就是模板(只用修改update). 可以对比一下代码(好像也差不多-) MY CODE # ...
- BZOJ 1818: [Cqoi2010]内部白点 (BIT + 扫描线)
就是求多条线段的交点数,直接BIT+扫描线就行了. 注意不要算重最初存在的点. CODE #include<bits/stdc++.h> using namespace std; char ...
- numpy常用矩阵操作
1.删除列 column_to_delete = [0, 1, 2] arr = np.delete(arr, [0, 1, 2], axis=1) 2.归一化 arr = normalize(arr ...
- 初识java的算术运算符
总所周知,算术运算符作为日常基本算法在我们上小学时接触到了,对加.减.乘.除熟练运用,这些基础算法也被引用到Java语言中.一般越基本的东西越重要,类比生活中的阳光,空气,水,土等... 闲话少叙,那 ...
- 解决SpringBootApplication右键没有启动项的问题
转载于 https://blog.csdn.net/weixin_41876599/article/details/82711302 感觉很有用
- cmd中实现代码雨的命令。。。
颜色修改时不能使用十六进制数 @echo off title digitalrain color 0b setlocal ENABLEDELAYEDEXPANSION for /l %%i in (0 ...
- template模板循环嵌套循环
template嵌套循环写法:在第一次循环里面需要循环的地方再写个循环,把要循环的数据对象改为第一层的循环对象别名 //template模板循环嵌套循环 <script id="ban ...
- 【知识库】-数据库_MySQL 的七种 join
掘金作者:haifeisi 文章出处: MySQL 的七种 join Learn [已经过测试校验] 一.内连接 二.左外连接 三.右外连接 四.左连接 五.右连接 六.全连接 七.两张表中都没有出现 ...