I have a pipeline that does a Maven install, and then a SonarCloud analysis using Maven. I have a m2 repository cache configured in the pipeline. I see the cache being used during the Maven install, but not in the Maven SonarCloud analysis. This is constant after three builds.
I have a private Nexus repository where dependencies are downloaded.
definitions:
caches:
custom-maven:
key:
files:
- pom.xml
path: /usr/share/maven/ref/repository
The Maven install step is as follows:
- step: &build-test
name: Build & test
caches:
- custom-maven
script:
- mvn -B -T2C install -s ./settings.xml
artifacts:
- target/*.jar*
The SonarCloud analysis:
- step: &sonarcloud
name: Static code analysis using SonarCloud
image:
name: [some private image]
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
caches:
- custom-maven
- custom-sonar
script:
- mvn -B -T2C verify sonar:sonar -s ./settings.xml
<localRepository>/usr/share/maven/ref/repository</localRepository>
The logs of the Maven install:
+ mvn -B -T2C install -s ./settings.xml[INFO] Scanning for projects...[INFO][INFO] Using the MultiThreadedBuilder implementation with a thread count of 8[INFO][INFO] ----------------------< package:artifact >----------------------[INFO] Building artifact 1.2.3.BUILD-SNAPSHOT[INFO] --------------------------------[ jar ]---------------------------------
The logs of the SonarCloud analysis:
+ mvn -B -T2C verify sonar:sonar -s ./settings.xml[INFO] Scanning for projects...[INFO] Downloading from private-nexus: https://private.nexus.com/repository/maven-public/com/spotify/dockerfile-maven-plugin/1.4.10/dockerfile-maven-plugin-1.4.10.pom[INFO] Downloaded from private-nexus: https://private.nexus.com/repository/maven-public/com/spotify/dockerfile-maven-plugin/1.4.10/dockerfile-maven-plugin-1.4.10.pom (5.6 kB at 5.7 kB/s)[INFO] Downloading from private-nexus: https://private.nexus.com/repository/maven-public/com/spotify/dockerfile-maven/1.4.10/dockerfile-maven-1.4.10.pom[INFO] Downloaded from private-nexus: https://private.nexus.com/repository/maven-public/com/spotify/dockerfile-maven/1.4.10/dockerfile-maven-1.4.10.pom (2.4 kB at 8.1 kB/s)[INFO] Downloading from private-nexus: https://private.nexus.com/repository/maven-public/com/spotify/foss-root/6/foss-root-6.pom...many more downloads...[INFO] Downloading from private-nexus: https://private.nexus.com/repository/maven-public/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar[INFO] Downloaded from private-nexus: https://private.nexus.com/repository/maven-public/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar (50 kB at 177 kB/s)[INFO][INFO] Using the MultiThreadedBuilder implementation with a thread count of 8[INFO][INFO] ----------------------< package:artifact >----------------------[INFO] Building artifact 1.2.3.BUILD-SNAPSHOT[INFO] --------------------------------[ jar ]---------------------------------
The cache is available when I look in the Bitbucket UI:
What I want is for the caching to work during the SonarCloud analysis as well. What is going on here? What can I do to fix this?
I talked with support, the cache is being used. The build time is faster. Maven seems to sometimes/always download certain dependencies. This might be a problem with our Maven configuration. So it has nothing to do with Bitbucket.
G'day, @Mark Gortzak
We require to review your pipeline build to investigate the issue further. Since an in-depth investigation is required, I have proceeded to raise a support ticket on your behalf.
Please find your ticket at our support portal:
https://support.atlassian.com/requests/
Regards,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.