I would like to retrieve from the command line the groupId, the artifactId & the version of a Maven project.
The proposed solution in this topic "How to get Maven project version to the bash command line" is to use the following plugin:
mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.artifactId
It works well but I can't figure out how to set, at the same time, the project.groupId, project.artifactId & project.version
to the -Dexpression argument.
I would avoid launching 3 times the Maven command with a different -Dexpression argument each time...
Thks
For the moment, I retrieve data by doing the following:
local pom_groupid=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.groupId |grep -Ev '(^\[|Download\w+:)'`
local pom_artifactid=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.artifactId |grep -Ev '(^\[|Download\w+:)'`
local pom_version=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.version |grep -Ev '(^\[|Download\w+:)'`