Here is our pipeline definition.
When running, I see that maven dependencies are downloaded on every run even pipeline is configured to use maven cache.
image: maven:3.9-eclipse-temurin-21
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- maven
- sonar
script:
- mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
artifacts:
- target/**
- step: &mirror-to-github
name: Mirror to Github
script:
- git push --mirror git@github.com:{account}/{repo}.git
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
custom: # Pipelines that can only be triggered manually
sonar:
- step: *build-test-sonarcloud
branches:
'{dev,*.X,*-sonar-*}':
- step: *build-test-sonarcloud
'release/*':
- step: *build-test-sonarcloud
- step: *mirror-to-github
pull-requests:
'**':
- step: *build-test-sonarcloud