Skip to content

Commit ee65e7e

Browse files
authored
Fix Maven on GHA by overriding the http wagon with a custom build. (#239)
* Fix Maven on GHA by overriding the http wagon with a custom build. * Addressed feedback.
1 parent c21925a commit ee65e7e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.github/fix-maven.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
MAVEN_HOME=$(./jdk-wrapper.sh ./mvnw -v | awk '/^Maven home:/ { print $3 }')
3+
if [ -d "$MAVEN_HOME" ]; then
4+
echo "Installing custom wagon-http jar to $MAVEN_HOME/lib"
5+
ls -l "$MAVEN_HOME/lib/"wagon-http-*-shaded.jar
6+
rm "$MAVEN_HOME/lib/"wagon-http-*-shaded.jar
7+
cp ./.github/wagon-http-* "$MAVEN_HOME/lib/"
8+
ls -l "$MAVEN_HOME/lib/"wagon-http-*-shaded.jar
9+
else
10+
echo "Unable to fix Maven!"
11+
fi
2.11 MB
Binary file not shown.

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jobs:
2727
path: ~/.m2
2828
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
2929
restore-keys: ${{ runner.os }}-m2-
30+
# The Maven fix involves replacing an artifact that is in the cache directory;
31+
# consequently the fix gets cached. The problem arises when we need to remove
32+
# the fix that we need to do so in a way that keeps the cache from regressing.
33+
# The easiest way is to change the cache key when deprecating the fix.
34+
- name: Fix Maven
35+
run: ./.github/fix-maven.sh
3036
- name: Build Only
3137
if: startsWith(github.ref, 'refs/tags/metrics-aggregator-daemon-') != true
3238
run: ./jdk-wrapper.sh ./mvnw clean verify -P rpm -U -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120

0 commit comments

Comments
 (0)