- export VARIABLE dosen't work in deploy Phase

Hello,

I discovered a weird bug in the deployment phase.
What I want to do is:
I want to extract the version number of my artefact and export it to an environment variable. But it doesn’t work. I and my co-worker tried everything. Even debugging via ssh didn’t give us any clue to what causes the problem, because everything worked fine when we did it manually.

Anyways here is my circle.yml:

machine:
  maven:
    version: 3.3.9

dependencies:
  pre:
    - curl -fL https://getcli.jfrog.io | sh
    - ./jfrog rt c --url $ARTIFACTORY_URL --apikey $ARTIFACTORY_API_KEY --interactive false
  override:
    - ./mvnw --fail-never dependency:go-offline || true

compile:
  override:
    - ./mvnw clean compile

test:
  override:
    - ./mvnw install

deployment:
  staging:
    branch: master
    commands:
    - export APPLICATION_VERSION_NUM=`find target -type f -name '*.jar' | grep -o -E '([0-9].*[^\.jar])'`
    - mv target/qds-*.jar $CIRCLE_ARTIFACTS/
    - ./jfrog rt u "$CIRCLE_ARTIFACTS/*.jar" "test-deploy/de/company/qds-core-library/$APPLICATION_VERSION_NUM/" --build-name=core-library --build-number=$CIRCLE_BUILD_NUM --flat=true
  test:
    branch: circleci
    commands:
    - export APPLICATION_VERSION_NUM=`find target -type f -name '*.jar' | grep -o -E '([0-9].*[^\.jar])'`
    - echo $APPLICATION_VERSION_NUM
    - mv target/qds-*.jar $CIRCLE_ARTIFACTS/
    - ./jfrog rt u "$CIRCLE_ARTIFACTS/*.jar" "test-deploy/de/company/qds-core-library/$APPLICATION_VERSION_NUM/" --build-name=core-library --build-number=$CIRCLE_BUILD_NUM --flat=true

Hopefully, you can help me!

Best Regards
David