harschware
harschware

Reputation: 13404

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.

Upvotes: 5

Views: 1333

Answers (1)

mhaller
mhaller

Reputation: 14232

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

Upvotes: 12

Related Questions