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

bitbucket pipeline spring boot maven cache not launch

cdov February 27, 2019
# 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

0 votes
Answer accepted
cdov March 1, 2019

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2019

Hi @cdov ,

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
cdov February 28, 2019

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

cdov February 28, 2019
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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 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?

cdov February 28, 2019

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
TAGS
AUG Leaders

Atlassian Community Events