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 pipeline always download dependencies



I'm using for the first time the pipeline feature in, and I'm surprised to see that for each build triggered by new commits, maven always download dependencies, even if they were previously downloaded in another build.


Is it a bug or not ?



2 answers

0 votes

This is an expected result of Bitbucket Pipelines build environments being comprised of ephemeral Docker containers that run automatically after each code push. That is, for each build a new Docker container is launched, and then terminated at the end of the build, which implies that all non explicitly managed files (like the cached Maven artifacts at hand) only live as long as the container itself.

This 'build from scratch' behavior is usually highly desired to guarantee that builds are completely isolated from each other. The obvious downside is that any form of build time and resource usage optimizations like caching dependencies does not work out of the box.

To facilitate those optimizations regardless, you can create custom Docker images and use these tailored build environments instead of the default ones. So for the scenario at hand you might want to create a container image that has those Maven dependencies downloaded already - of course, such tailored images should ideally be maintained via CI/CD as well, and while Bitbucket Pipelines itself cannot yet build Docker images, Bitbucket still offers an indirect approach for this via Docker Hub as outlined in Configure automated builds with Bitbucket (beware that this has nothing to do with Pipelines at all).

For all the people dropping by currently, please note that Atlassian now supports caching dependencies via the "cache" directive in the piplelines yml file. Refer to

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,094 views 4 22
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