Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Passing repository variables to Java Maven test project via command line

David Smiles
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 2, 2025

I am trying to pass some Repository Variables to a Java program via Maven command line.  

Some of the repository variables are not getting replaced with their the respective values (i.e. the DB_PASS and USER_PASS).  

What the application receives is $DB_PASS and $USER_PASS.  

Whereas, the $CUCUMBER_TAG is passed as expected, but that is passed in from the BitBucket 'run pipeline' UI.

Note: The password values are marked as secure on the repository variables page.

I've read the documentation on this, but I'm obviously missing something.  Can anyone advise me?

- step:

    name: Run tests

    script:

      - echo "Starting tests"

      - mvn test \

          -Dtest-documents-path=$BITBUCKET_CLONE_DIR/test-documents \

          -Chrome-documents-path=/test-documents \

          -Dtest-env=pipeline-qa \

          -Ddb_pass="$DB_PASS" \

          -Duser_pass="$USER_PASS" \

          -Dcucumber.filter.tags="$CUCUMBER_TAG"

 

1 answer

0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 6, 2025

G'day, @David Smiles 

Welcome to the community!

I believe you have covered most aspects of using variables, but have you confirmed that the database username and password are valid? If you haven't already, and if security best practices allow, try using echo $variable to display the value of the variables and verify if it's correct.

Regards,
Syahrul

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events