I would like to cache the `target` (output) directory of a Maven build in Pipelines but I would like to exclude the `target/failsafe-reports` and `target/surefire-reports` subdirectories. How can I achieve that?
Hi Sayo,
Unfortunately - there's no formal way of excluding certain files/folders from caches in Pipelines. Rather than excluding files/folders, you could specify which folders/files you wished to include and just choose to not include any that you do not wish to be cached.
Is this feasible for what you wish to achieve?
Cheers!
- Ben (Bitbucket Cloud Support)
Hi Ben,
Thanks for the answer. Can I do that under a single cache declaration? Something like this:```my-cache: - path/1
- path/2```
Right now the recommended way of caching multiple folders is to declare multiple caches but that's slow since the caches are fetched and decompressed sequentially.
Hi @Sayo Oladeji
Can you try define multiple folders like this and let me know how it goes? You will need to run it at least twice for the cache to get created:
path: ./folder1 && ./folder2
hello
With Maven 3.9+ you should use Maven Build Cache plugin for this : https://maven.apache.org/extensions/maven-build-cache-extension/
It looks like you're new here. Sign in or register to get started.