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

bitbucket pipeline spring boot maven cache not launch

# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.6.0

pipelines:
default:
- step:
name: Clean Build
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B clean # -B batch mode makes Maven less verbose
- step:
name: Compile build
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B compile # -B batch mode makes Maven less verbose
- step:
name: Package build
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B package # -B batch mode makes Maven less verbose
artifacts:
- target/**
- step:
name: Deployment
deployment: test
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $APPLICATION_NAME
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
S3_BUCKET: $S3_BUCKET
ZIP_FILE: 'target/ezstore-1.0.jar'


above is my pipeline, when it run, i can see from build set up,cache is extracted
Cache "maven": DownloadingCache
"maven": Downloaded 1.7 MiB in 2 seconds
Cache
"maven": Extracting
Cache
"maven": Extracted in 0 seconds

However, I can still see cache is not use and it keep download from maven central

[INFO] Scanning for projects...[INFO] [INFO] --------------------------< edu.mum:ezstore >---------------------------
[INFO] Building EZStore API 1.0[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.1.0/maven-resources-plugin-3.1.0.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.1.0/maven-resources-plugin-3.1.0.pom (7.2 kB at 34 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.1.0/maven-resources-plugin-3.1.0.jar

Please let me know what is wrong with it


2 answers

1 accepted

Some problem with the cache as it is not updated and stuck in 1.77mb, I deleted the cache and run again the cache went up to 70+mb. now cache is loaded

 

Screen Shot 2019-03-01 at 11.06.00 PM.png

0 votes
edwin Community Leader Feb 28, 2019

Hi @Chi Proeng Dov ,

Please try using one step

mvn -B clean package

 package will compile your code and also package it. For example, if your pom says the project is a jar, it will create a jar for you when you package it and put it somewhere in the target directory (by default).

One step for build and one for deployment.

- step:
name: Clean / Package Build
caches:
- maven
script:
- mvn -B clean package
- step:
name: Deployment

I see what you mean, but why it is not pick up the cache if I have multiple step?

image: maven:3.6.0

pipelines:
default:
- step:
name: Clean and Package build
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B clean package # -B batch mode makes Maven less verbose
artifacts:
- target/**
- step:
name: Deployment
deployment: test
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $APPLICATION_NAME
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
S3_BUCKET: $S3_BUCKET
ZIP_FILE: 'target/ezstore-1.0.jar'
here is updated pipeline

still it is downloading the cache, even I did run it twice
edwin Community Leader Feb 28, 2019

Please try moving caches as your first step. 

Screen Shot 2019-02-28 at 12.04.26 PM.png

Do you see caches as shown? Have you had a successful build?

Screen Shot 2019-02-28 at 12.57.22 PM.pngthe build is sucess, by the way i am using maven 3.6.0 image

Suggest an answer

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

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

453 views 0 10
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