Get version number of a dependency from pom.xml using command line and use that version number to tag a docker image

  cmd, docker, maven, pom.xml

I have a pom file. I want to read the version of the first dependency in the dependencies tag and use that version to tag our docker image.

I am using this command to get the project version.

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

I want to get the version of the first dependency using command line , and from there it will passed onto the docker tag and docker push.

enter image description here

Source: Docker Questions

LEAVE A COMMENT