maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stug23 <>
Subject Better way to capture output from a Maven job
Date Fri, 11 Apr 2014 20:32:42 GMT
I have a script that needs to obtain the three-part numerical version from a
Maven pom.xml. I am using the Maven help plugin to the version number as

mvn help:evaluate -Dexpression=project.version

Of course when running the Maven job, you get a great deal of output lines
and towards the end the project.version number. In my script I use a grep to
snatch the three-part numerical version from the Maven output:

mvn help:evaluate -Dexpression=project.version | grep -o

So if I have a pom.xml with project/version = 1.2.3-SNAPSHOT, the command
above returns the result '1.2.3'

While this works okay, I would have hoped for a better way to return a value
from Maven. Is there a return/result parameter of some sort such that I
don't have to pick the result out of the entire text output of the Maven job

View this message in context:
Sent from the Maven - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message