name: CI

on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master

jobs:
  build:
    strategy:
      matrix:
        java: [ '8', '11', '15' ]
        os: [ 'ubuntu-latest' ]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK
      uses: actions/setup-java@v1
      with:
        java-version: ${{ matrix.java }}
    - name: print Java version
      run: java -version
    - uses: actions/cache@v2
      with:
        path: ~/.m2/repository
        key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
        restore-keys: |
          maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
          maven-${{ runner.os }}-
          maven-
    - name: Build
      run: mvn --no-transfer-progress -B clean verify
    - name: Clean before caching
      run: find ~/.m2 -name "_remote.repositories" | xargs rm

name: CI

on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master

jobs:
  build:
    strategy:
      matrix:
        java: [ '8', '11', '15' ]
        os: [ 'ubuntu-latest' ]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK
      uses: actions/setup-java@v1
      with:
        java-version: ${{ matrix.java }}
    - name: print Java version
      run: java -version
    - uses: actions/cache@v2
      with:
        path: ~/.m2/repository
        key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
        restore-keys: |
          maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
          maven-${{ runner.os }}-
          maven-
    - name: Build
      run: mvn --no-transfer-progress -B clean verify
    - name: Clean before caching
      run: find ~/.m2 -name "_remote.repositories" | xargs --no-run-if-empty rm

Call rm only if operands exist
Call rm only if operands exist

Motivation:
Github action failed

Modifications:
Use `--no-run-if-empty` option for `xarg`

Result:
Github action succeed
