maven输出项目版本的方式

输出maven项目版本的方法,可以使用Maven Help Plugin

这个命令:

$ mvn -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate \
    -Dexpression=project.version

$ RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

$ echo $RESULT
1.0.0-SNAPSHOT

以上是使用方法。

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues