There is git submodule , dictionary-jpa
, in a public github repository https://github.com/rxue/dictionary-ci-cd
The content of .gitmodules
is the following
[submodule "dictionary-jpa"]
path = dictionary-jpa
url = [email protected]:rxue/dictionary-jpa.git
On base of this setup, a Github Action is created with the following script
name: Build
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
submodules: recursive
#settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: List submodule content
run: |
ls -al dictionary-jpa
- name: Build submodule
run: mvn -B compile --file dictionary-jpa/pom.xml
This action is expected to compile the code inside the submodule dictionary-jpa
Problem: Based on the output of the command ls -al dictionary-jpa
, the submodule is empty when the action is being executed, and as a result the mvn compile
failed since it cannot find the pom.xml
and the source code in the src
even though the original repository i.e. the submodule
has all the needed files
I added the submodules: recursive
according to answers from some other similar questions, but it does not work