Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Export Code Artifact Token in pipeline and use it to download dependency in Maven project

I have a pipeline for a Maven project, which contains 2 modules in it. In one of the modules, there is a dependency for a remote project, which can be pulled as a code artifact. The problem is that when i generate a token for AWS, to authenticate the for the download from the remote repository, the module which needs to pull the code artifact doesn't get authorization to download it. I get 401 unauthorized when whe pom.xml file tries to pull the dependency

- step:
name: Build and Test
- yum install sudo -y
- yum install zip unzip -y
- curl "" -o ""
- unzip
- sudo ./aws/install
- aws configure set aws_access_key_id $ACCESS_KEY
- aws configure set aws_secret_access_key $SECRET_ACCESS_KEY
- aws configure set profile.$PROFILE_NAME.source_profile default
- aws configure set profile.$PROFILE_NAME.region $AWS_REGION
- aws configure set profile.$PROFILE_NAME.role_arn $PROFILE_ARN
- export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $DOMAIN_OWNER --query authorizationToken --output text --profile $PROFILE_NAME`
- cat $MODULE_PATH/settings.xml
- mvn clean deploy -s $MODULE_PATH/pom.xml -P snapshot
- mvn verify --file pom.xml

Currently I'm writing using the 'sed' command to write the password directly in settings.xml, because I wasn't sure if it was being exported properly, but it doesn't work either way. From the 'cat' command i can verify that the token is actually written in the settings.xml file. Note that the only environment variable im using in the original pipeline is the $CODEARTIFACT_AUTH_TOKEN. I'm just using variables for everything here to not show sensitive data.

1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 16, 2022

Hi @Tasho Georgiev

Welcome to the community.

Just wanted to confirm if the settings.xml file is located under the location "/usr/share/maven/conf"?
This is because you'll need to override the default Maven settings.xml found in the Docker image.

To access a private Maven repository, you'll need to override the default Maven settings.xml found in the Docker image at /usr/share/maven/conf/settings.xml.

Alternatively, you can also override the file by using your own version of the settings.xml file using the command below:

mvn -s settings.xml

You can also check out this link for more information.

Let me know how it goes.

Mark C

Hi @Mark C , since posting the question, I was able to resolve the problem. It was indeed missing the settings.xml file. After adding it to the project the issue was resolved.

Still, thank you for the reply!

Like Mark C likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events