Missed Team ’24? Catch up on announcements here.

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

maven cache in pipeline seems not working

Zhenguo Li April 13, 2022

I have added below script in pipeline, but it seems not working , every build take more than 30 min for mvn install , any problem recently for this cache function ?

image: maven:3.6.3

pipelines:

branches:
develop:
- step:
name: Build and Unit Test
artifacts:
- x_api/target/x_api.jar
- checkstyle-result.xml
image: maven:3.6.3
caches:
- maven
script:
#- mvn -B verify --file pom.xml
- cd x_api
- mvn install
- mvn package --batch-mode
- cd ../x_service
- mvn install
- mvn package --batch-mode

 thank you,

Jonas

3 answers

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 19, 2022

Hi Jonas,

I just wanted to let you know that we have a limit of 1GB for caches, only caches under 1GB once compressed are saved.

Maven cache is saved in the directory ~/.m2/repository, so I would suggest checking the size of this directory during the build and after dependencies are downloaded.

If the repo belongs in a workspace with a paid billing plan (I see you are an admin of such a workspace), you can also create a ticket with the Bitbucket Cloud support team to look into this and confirm if the issue is with the cache size or something different. You can create a support ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product.

Kind regards,
Theodora

Zhenguo Li April 19, 2022

thank you Theodora for guide , I submitted a ticket to see if any solution.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 20, 2022

You are welcome Jonas, please feel free to reach out if you ever need anything else.

Kind regards,
Theodora

0 votes
Zhenguo Li April 13, 2022

I saw below in pipeline log

 

Cache "maven": Not found

 

is there any limit like size of the maven cache , possible exceed the limit cause maven was not cached

lissyaka April 13, 2022

@Zhenguo Li  what image do you use? Please provide your full pipeline config and log output

Also take a look at this answer

Zhenguo Li April 13, 2022
image: maven:3.6.3

pipelines:

branches:
develop:
- step:
name: Build and Unit Test
artifacts:
- x_api/target/x_api.jar
- checkstyle-result.xml
image: maven:3.6.1
caches:
- maven
script:
#- mvn -B verify --file pom.xml
- cd x_api
- mvn install
- mvn package --batch-mode
- cd ../x_service
- mvn install
- mvn package --batch-mode

 

Zhenguo Li April 13, 2022

i can't paste full log here, it just said there is no cache for maven in build setup step.

and there is no any cache shows if I click the Cache button on pipeline's home page.

lissyaka April 15, 2022

@Zhenguo Li. To check if maven cache working or not you should try to run pipeline this example repo

If cache is not working its definitely a bug and you may report it.

If cache is working then problem is in your `script section`. I think the reason is that you changing folders and then run `mvn install` when your cache possibly is in upper folder, but i can be wrong.

Look at this answer to understand how to define cache for custom folder

P.S also you do not need

image: maven:3.6.1

in `step` section because you use

image: maven:3.6.3

in the beginning of your pipeline config. I understand that i suggested you to do it but also it explains why i asked you to provide the full pipeline config to provide better help.

Cheers

0 votes
lissyaka April 13, 2022

Hi @Zhenguo Li . At least you should add more details about your pipeline config.

Also take a look at this answer: maven cache not working .
There

image: maven:3.6.1  

was added before caches, maybe this will fix your issue.

Cheers

Zhenguo Li April 13, 2022

thank you, @lissyaka ,  but it doesn't work for me .

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events