利用maven-help-plugin在shell中读取pom_xml的变量
# 安装maven-help-plugin
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.2.0</version>
</dependency>
1
2
3
4
5
2
3
4
5
# 读取变量
RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo $RESULT
1
2
2
参考:
https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html (opens new window)
编辑 (opens new window)
上次更新: 2023/09/19, 13:33:19