Get properties from pom and use in script


I use gitlab for my java project. I’m on windows.

How to retrieve the version value in the pom.xml and use it in my script please?

    stage: build
        - prod
        - asadmin stop-domain domain1
        - mvn -Pprod -DskipTests=true clean install
        - rm -r -fo "C:/Program Files/glassfish6/glassfish/domains/domain1/applications/*"
        - rm -r -fo "C:/Program Files/glassfish6/glassfish/domains/domain1/generated/*"
        - rm -r -fo "C:/Program Files/glassfish6/glassfish/domains/domain1/session-store/*"
        - VERSION=$(mvn help:evaluate -Dexpression=version -q -DforceStdout)
        - echo $VERSION
        - cp -fo "versions/$VERSION/engine "C:\engine-api"
        - Start-Service -Name "domain1"
        - master

Thank you.

    - apk add jq git
    - export VERSION=$(jq -r .version pom.xml)

maybe you can do somethink like that.
insted of using apk you can install jq manually and use it. but this depends on your structure. I build my stuff in a sandbox where i need to install all build tools, this is why i use this as a step in my build script.

ok I found it was necessary to put $VERSION=.