'Github Workflow Maven Caching - Multi-Module Project

I am working on integrating Sonar for a multi-module Maven Project which has 3 modules. I need to speed up the Maven Build Process by enabling caching. Sonar Reports are working correctly but still the caching is not happening. Below here find the Github Workflow File with the configurations which I want to cache the dependencies only relevant to the cloud-pci-ui module

Module Structure

Maven Caching Error

name: Analyze pull request
on:
  # Trigger analysis when open edit, synchronize or re-opene a pull request. 
  pull_request:
    types: [opened, edited, synchronize, reopened]
env:
  # Sets environment variable
  AWS_REGION : us-east-1

jobs:
  buildAndAnalysePR:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # Disabling shallow clone is recommended for improving relevancy of reporting
          fetch-depth: 0
      - uses: actions/setup-java@v2
        with:
          distribution: 'adopt'
          java-version: '8'
          cache: 'maven'
      - name: Cache local Maven repository
        uses: actions/cache@v2
        with:
          path: ~/cloud-pci-ui/.m2/repository/
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
      - name: Build PCI-API
        run: |
          cd cloud-pci-api
          mvn clean install -DskipTests


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source