Skip to content

Enable caching for Maven #5

Enable caching for Maven

Enable caching for Maven #5

Workflow file for this run

name: Maven Package
on:
push:
branches-ignore: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Package with Maven
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw --batch-mode package org.sonarsource.scanner.maven:sonar-maven-plugin:sonar