maven build pipeline always download dependencies

mbus January 26, 2017

Hi,

 

I'm using for the first time the pipeline feature in bitbucket.org, 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 ?

 

Regards,

2 answers

0 votes
VIKRANTH MOHANRAO December 14, 2017

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 https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html.

0 votes
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2017

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).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events