Extract the required information from pom.xml

When the following command is executed, "groupId: artifactId: version" is displayed from guice-3.0.pom.

mvn -f guice-3.0.pom -q '-Dexec.executable=echo' '-Dexec.args=${project.groupId}:${project.artifactId}:${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.6.0:exec

You can freely change the output contents by changing the character string passed to exec.args. Reference: https://stackoverflow.com/a/39665194

It can be obtained as follows, but it seems that multiple parameters cannot be taken together.

mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate "-Dexpression=project.version" -q -DforceStdout

Reference: https://stackoverflow.com/a/3545363

Recommended Posts

Extract the required information from pom.xml
[Java] How to extract the file name from the path
Extract a specific element from the list of objects
[XML] Obtaining earthquake information from the Japan Meteorological Agency ①