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 follows:
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 '^[0-9]*\.[0-9]*\.[0-9]*' 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 execution? -- View this message in context: http://maven.40175.n5.nabble.com/Better-way-to-capture-output-from-a-Maven-job-tp5790942.html Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
