Skip to content

Commit 38860c4

Browse files
authored
Automatically fetch & use the latest Maven 3 patch version for Docker builds/publish workflow (#203)
1 parent 38635b8 commit 38860c4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ RUN apt-get update && apt-get install -y openssh-server vim python3 --no-install
1717
rm -rf /var/lib/apt/lists/* && \
1818
service ssh start
1919

20+
COPY scripts/get-latest-maven-version.sh ./get-latest-maven-version.sh
21+
RUN chmod +x ./get-latest-maven-version.sh
22+
2023
# Copy CDM jar & template files
21-
ARG MAVEN_VERSION=3.9.3
24+
ARG MAVEN_VERSION=$(./get-latest-maven-version.sh)
2225
ARG USER_HOME_DIR="/root"
2326
ARG BASE_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
2427
ENV MAVEN_HOME /usr/share/maven

scripts/get-latest-maven-version.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
MAVEN_BASE_VERSION=3.9
4+
MAVEN_REPO_URL="https://archive.apache.org/dist/maven/maven-3/"
5+
6+
curl -sSL ${MAVEN_REPO_URL} | \
7+
grep -o "${MAVEN_BASE_VERSION}\.[0-9]*\/" | \
8+
sort -V | \
9+
tail -n1 | \
10+
sed 's/\///'

0 commit comments

Comments
 (0)