[转] 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这样的命 ...
随机推荐
- Linux之yum软件管理
YUM yum = Yellow dog Updater, Modified主要功能是更方便的添加/删除/更新RPM包.它能自动解决包的倚赖性问题. 它能便于管理大量系统的更新问题 yum特点 *可以 ...
- SqlServer获取当前日期
1. 获取当前日期 select GETDATE() 格式化: ) ---- :: 2. 获取当前年 --2017 3.获取当前月 --05或5 4.获取当前日期 --07或7 select DAY ...
- Vue双向绑定的实现原理系列(四):补充指令解析器compile
补充指令解析器compile github源码 补充下HTML节点类型的知识: 元素节点 Node.ELEMENT_NODE(1) 属性节点 Node.ATTRIBUTE_NODE(2) 文本节点 N ...
- Linux配置python环境2,安装python
安装锁需要的依赖包 sudo apt-get -y install gcc-5 g++-5 libc6-dev make build-essential libssl-dev zlib1g-dev l ...
- Navicat for Mysql查询结果导出无表名
在查询窗口用select语句按条件查出所需结果,然后用“导出向导”把查询结果导成sql文件,但是导出来的sql语句没有表名了. 导成的sql文件大致是这样的, INSERT INTO `` (`id` ...
- nginx信号
ps aux | grep nginx #查看nginx进程,要查看nginx的pid,就得使用这个命令查看*********************nginx信号****************** ...
- 判断一个ip地址合法性(基础c,不用库函数)
#include <stdio.h> int judge(char *strIp); int main() { ]; ) { scanf("%s", a); == ju ...
- 【CUDA 基础】3.6 动态并行
title: [CUDA 基础]3.6 动态并行 categories: - CUDA - Freshman tags: - 动态并行 - 嵌套执行 - 隐式同步 toc: true date: 20 ...
- Unity3D面试问题
注意,是问题,不是笔试题哦.这些是我最近面试北京各公司总结的一些被问到的还算典型的问题.跟大家分享一下.答案是我自己的,不保证标准和完整. 哎,公司年底开人,又校招一群便宜的小鬼……桑死心了……好在找 ...
- Python基础之注释
有时候我们写的东西不一定都是给用户看的,或者不希望解释器执行,那么我们可以选择注释掉代码. 被注释的内容是不会执行的,可以方便在以后能读懂代码. 注释分为两种,一种是单行注释,一种是多行注释. 单行注 ...