Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query Pom version using maven

Is there a goal one can execute that will just echo the version of a pom? I can think of a way to make it work using the maven-ant-plugin, but that requires me to have ant-plugin configuration in the pom and I would like a method that would work with any pom.

like image 291
harschware Avatar asked Dec 23 '22 03:12

harschware


1 Answers

mvn help:evaluate -Dexpression=project.version

If you want just the version echoed, and not the rest of the Maven "noise", you would use

mvn help:evaluate -Dexpression=project.version -q -DforceStdout
like image 180
mhaller Avatar answered Dec 27 '22 09:12

mhaller