Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to exclude some files and subdirectories from Pipelines cache

Sayo Oladeji August 17, 2023

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?

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 17, 2023

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)

Sayo Oladeji August 18, 2023

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.

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2023

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

Cheers!

- Ben (Bitbucket Cloud Support)

stauvel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 7, 2023

hello

With Maven 3.9+ you should use Maven Build Cache plugin for this : https://maven.apache.org/extensions/maven-build-cache-extension/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events