Printing the version of a Maven project

To print a Maven project’s version number, try:

mvn help:evaluate -Dexpression=project.version -q -DforceStdout

-q suppresses all output(!)

-DforceStdout unsuppresses the actual thing you asked to be printed.

I will refrain from commenting on how difficult this was to find.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.