It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Maven build failing on Bamboo with Unauthorized error

Hello,

We have some dependencies in our project defined in a particular repository and while doing build on Bamboo server it fails with Unauthorized error.

 

This particular respository isn't defined in settings.xml of Maven_Home file so its failing with Unauthorized error. Below are bamboo build error logs.

 

build   26-Jun-2018 09:29:39    [INFO] Downloaded from Central: http://repo1.maven.org/maven2/org/apache/ant/ant-parent/1.9.6/ant-parent-1.9.6.pom (5.6 kB at 28 kB/s)

build   26-Jun-2018 09:29:39    [INFO] Downloading from Central: http://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.6/ant-launcher-1.9.6.pom

build   26-Jun-2018 09:29:39    [INFO] Downloaded from Central: http://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.6/ant-launcher-1.9.6.pom (2.3 kB at 12 kB/s)

build   26-Jun-2018 09:29:39    [INFO] ------------------------------------------------------------------------

build   26-Jun-2018 09:29:39    [INFO] BUILD FAILURE

build   26-Jun-2018 09:29:39    [INFO] ------------------------------------------------------------------------

build   26-Jun-2018 09:29:39    [INFO] Total time: 01:46 min

build   26-Jun-2018 09:29:39    [INFO] Finished at: 2018-06-26T09:29:39Z

build   26-Jun-2018 09:29:39    [INFO] Final Memory: 22M/249M

build   26-Jun-2018 09:29:39    [INFO] ------------------------------------------------------------------------

build   26-Jun-2018 09:29:39    [ERROR] Failed to execute goal on project cs-monitor-p: Could not resolve dependencies for project com.mycompany:cs-monitor-p:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at com.mulesoft.muleesb:mule-core-ee:jar:3.9.0: Failed to read artifact descriptor for com.mulesoft.muleesb:mule-core-ee:jar:3.9.0: Could not transfer artifact com.mulesoft.muleesb:mule-core-ee:pom:3.9.0 from/to mule-ee-releases (https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]

build   26-Jun-2018 09:29:39    [ERROR]

build   26-Jun-2018 09:29:39    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

build   26-Jun-2018 09:29:39    [ERROR] Re-run Maven using the -X switch to enable full debug logging.

build   26-Jun-2018 09:29:39    [ERROR]

build   26-Jun-2018 09:29:39    [ERROR] For more information about the errors and possible solutions, please read the following articles:

build   26-Jun-2018 09:29:39    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

simple  26-Jun-2018 09:29:39    Failing task since return code of [/usr/share/apache-maven/bin/mvn --batch-mode -Djava.io.tmpdir=/opt/atlassian/atlassian-bamboo-6.5.0/temp/IM-CSMON-JOB1 clean test] was 1 while expected 0

simple  26-Jun-2018 09:29:39    Parsing test results under /efs/bamboo/xml-data/build-dir/IM-CSMON-JOB1...

 

 

Is it possible to pass the repository as Environmental Variables and then execute build plan? I wanted to execute Maven build without changing settings.xml on Bamboo server and pass the server details as some sort of arguments. Below are server details from settings.xml from local and this needs to be added to Maven build on server at runtime of build plan.

<server>

<id>MuleRepository</id>

<username>xxxxxxxxxx</username>

<password>xxxxxxx</password>

</server>

 

@Gabriel Ribeiro

Please let me know how to achieve this

4 answers

0 votes

Hello, 

Instead of work with paramaters in this situation, to my understand, it will be better if you setup maven proxy. 

 

Then you can achieve central place for manage settings. 

 

 

Cheers,

Gonchik Tsymzhitov

@Gonchik Tsymzhitov I'm sorry, i didn't understand what you are trying to say above.

 

Maven build is failing since my build plan needs access to remote repository which is not mentioned in settings.xml file on Bamboo server.

 

As far i know i need to add server configuration to settings.xml on bamboo server but without doing above how can i specify directly in my build plan about the remote respository ?

 

Hope you got what i'm trying to say.

 

Thanks

Hi Rohit,

Have you solved above issue? 

I am getting the same error, please help

@bhagyashree khedkar its resolved, can you share the error logs ? is Maven configured on Bamboo server i.e in settings.xml ?

Below is the error,

Its mule application and I want to setup CICD using bitbucket pipeline.Screenshot 2018-10-29 at 14.30.49.png

we have been using Bamboo for CI/CD and what you are using is quite different Bitbucket Pipepline for CI/CD.

 

But the issue looks same, the project couldn't fetch the dependencies required for Maven build. You need to update settings.xml file with nexus repository credentials.

 

As you set up Maven on your local machine do the same on the bitbucket server pipeline also.

check if this helps

https://community.atlassian.com/t5/Bitbucket-questions/settings-xml-configuration-on-Pipelines/qaq-p/167693

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

664 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you