8000 Fix maven local repo cache in CI · Labs64/NetLicensingClient-java@73dd77f · GitHub
[go: up one dir, main page]

Skip to content

Commit 73dd77f

Browse files
authored
Fix maven local repo cache in CI
1 parent ea09846 commit 73dd77f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/netlicesning-client-ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ jobs:
1414
build:
1515
runs-on: [self-hosted]
1616
container: maven:3.8.6-openjdk-11
17+
env:
18+
# This is needed, as java doesn't respect the environment variable $HOME, but gets the
19+
# user home by other means from the system. The default user in the above container is
20+
# 'root' with the home at '/root', while GitHub runner overrides $HOME to the mounted
21+
# '/github/home'. As a result, maven uses the ~/.m2 at a different location than assumed
22+
# by the standard GitHub actions like 'actions/setup-java', causing caching of the maven
23+
# local repository not working.
24+
# TODO(2K): This can be better solved by preparing a custom image for the container.
25+
MAVEN_OPTS: -Duser.home=/github/home
1726
strategy:
1827
matrix:
1928
java-version: [11]
@@ -27,7 +36,7 @@ jobs:
2736
distribution: 'adopt'
2837
cache: maven
2938
- name: Build with Maven
30-
run: mvn clean verify
39+
run: mvn -B clean verify
3140
- name: Run Demo App
3241
run: |
3342
ls -la NetLicensingClient-demo/target/

0 commit comments

Comments
 (0)
0