I try to extract the project.version from my maven project pom file using the help plug-in and assign it to a variable so I can use it to push my docker image.
- step:
script: # Modify the commands below to build your repository.
- POM_VERSION='mvn help:evaluate -Dexpression=project.version -q -DforceStdout'
- echo "version ${POM_VERSION}"
But all I get in my log is
version mvn help:evaluate -Dexpression=project.version -q -DforceStdout
When I expected to get
version 1.0.4
How can I get the command output assigned to a variable?
Think I finally found it by trail and error
export POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version $POM_VERSION"
version 1.0.4
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.