Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How to use maven release plugin with bitbucket pipelines? Edited

How do I get the maven release plugin to work with bitbucket pipelines?

Our pipeline is utilizing BITBUCKET_GIT_HTTP_ORIGIN for the configuration of the release with the following steps:

mvn -B release:prepare
mvn -B release:perform

mvn release:prepare works correctly and updates versions and commits it back to origin. However, the release:perform step fails with the following error:

[ERROR] Cloning into '/opt/atlassian/pipelines/agent/build/target/checkout'...
[ERROR] fatal: could not read Username for '': No such device or address

 The clone command it is trying to run:

[INFO] Executing: /bin/sh -c cd /opt/atlassian/pipelines/agent/build/target && git clone --branch v1.0.8 <private-project-url-removed> /opt/atlassian/pipelines/agent/build/target/checkout

The url that it is using is the same from the other bitbucket commands that were executed from the release:prepare step. 


1 answer

0 votes

Hi Zachary,

Are you sure the url is identical? In particular, check to make sure that it is a "http" url and not a "https" url. Git operations against origin go via a local proxy (running alongside your build container and only accessible to your build) and if you look at the value of BITBUCKET_GIT_HTTP_ORIGIN you'll see that it uses the plain, unsecured "http" protocol. The proxy establishes a secure "https" connection when it talks to the real server.

(This all assumes that you're connecting to the origin server of your main repository, which it seems like you are doing. If I've misunderstood and you're actually trying to connect to another repository or another server then that connection won't be using the local proxy. It should use a secure protocol and it will require that you set up authentication manually).

Yes I am sure it's using http. Like I said, the 'prepare' phase is working correctly which pushes commits back to the original repo.

Our team will be moving away from bitbucket for our CI solution. We have spent too much time already trying to get around the bugs.

You should use the exactly url show in BITBUCKET_GIT_HTTP_ORIGIN, example






@Miuler I'm facing a very similar issue during the `maven prepare` when it is trying to push:

fatal: could not read Username for '': No such device or address

What do you mean by your response above? Are you saying that in the `pom.xml` we must not use https for the `scm` tag. Like this?

    <scm>    <connection>scm:git:[company]/[project].git</connection>        <developerConnection>scm:git:[company]/[project].git</developerConnection>

I'm able to get this to work flawlessly with `https` from my local machine. But this seems to be not a well-documented process from bitbucket pipelines.

Could someone provide a sample bitbucket-pipelines.yml file? It seems you must provide a command that does not trigger an infinite loop:

git remote set-url origin ${BITBUCKET_GIT_HTTP_ORIGIN}
mvn -B -Dmaven.test.failure.ignores -f pom.xml release:clean release:prepare release:perform -DscmCommentPrefix="[skip ci]"

But what do before this? 

There are an amazing variety of answers out there for getting maven release to work, but none that seem to be complete and/or work.

This was the best example I could find:

It is is not complete either, but comes close to working.

Other issues to consider,

  • use SSH, not HTTPS
    • Do not reset the upstream repo for pushes like so many instructions suggest, as it is already done in the image and it sets up the proxy that is needed: 
      • git remote set-url origin ...
  • you will probably not want to do a manual release like in the example. Change both steps to automatic triggers.
    • If you do this, you must set the Prefix on the commit messages to be a token that BitBucket uses to prevent an infinite loop.
    • Also, if you require a commit message with a JIRA ticket number, you can use this same prefix to include a dummy value
  • Maven release:prepare not actually finishing all the steps it is supposed to do, but there is no error to make it obvious
  • You may want to rename the tag
  • Do not use git config --global when setting the '' and '', or you may end up with values that seem to be set by image automatically and thus prevent branch permissions from being able to be set effectively.
    • In raw commit: 
      From: bitbucket-pipelines <>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

197 views 2 1
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