[转] 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这样的命 ...
随机推荐
- 关于layui表格渲染templet解析单元格的问题
原文链接:https://blog.csdn.net/wyp_comeon/article/details/81735951关于表格解析自定义单元格的解析参数请先详细查看官方文档:http://www ...
- C#工具:ASP.net 调用SQLserver帮助类
一.正常调用 1.创建DBHelper帮助类 2.复制以下代码到类中 using System; using System.Collections.Generic; using System.Data ...
- 使用SetWindowHookEx注入global hook
写下这是为了自己复习的. 主要实现的是给File Explorer注入鼠标钩子,以检测鼠标是否在File Explorer上点击 .cpp #include <Windows.h> #in ...
- c语言结构体以及结构体指针的使用
结构体: 正常定义一个结构体: typedef struct node{ ]; int len; }Seq,*llink; 定义结构体指针: Seq *s;或者llink t;之后关于s与t的用法,其 ...
- mongodb 批量添加、修改和删除
1.使用MongoTemplate a.批量插入 Insert a Collection of objects into a collection in a single batch write to ...
- 为微信二维码添加gif动态背景
环境准备 来源: https://github.com/sylnsfar/qrcode/blob/master/README-cn.md#%E5%8A%A8%E6%80%81gif%E4%BA%8C% ...
- hadoop安装后运行一个单实例(测试MapReduce程序)
1.安装hadoop 解压hadoop-1.2.1-bin.tar.gz包 tar -zxvf hadoop-1.2.1-bin.tar.gz /opt/modules/ 解压后在/opt/mo ...
- httpclient个人理解
httpclient:模拟浏览器发送请求,服务器会响应数据,用心区域网内 不同系统间的请求调用 依赖 httpclient.jar和httpcore.jar需要同时纯在 <dependency ...
- 记一次protobuf和hbase自带protobuf版本冲突的解决
使用protobuf生产模板代码,使用的版本是: <dependency> <groupId>com.google.protobuf</groupId> <a ...
- 7.1 Spring原理
7.1 Spring原理 一.spring是什么?(IOC.AOP.MVC) Spring是一个基于IOC和AOP的结构J2EE系统的框架 , 1.1 IOC 控制反转 是Spring的基础,Inve ...