From f4c6807aa83c93ece2800e4218291e7d96fccb72 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Tue, 20 Aug 2024 21:14:35 +0200 Subject: [PATCH] chore: prepare docs and tests for maven 4 --- README.md | 10 +++++----- common.sh | 2 +- publish.sh | 2 +- tests/maven.Tests.ps1 | 4 ++-- tests/tests.bats | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 06e63d6b..fcf45742 100644 --- a/README.md +++ b/README.md @@ -118,18 +118,18 @@ passing a Maven command to `docker run`: ### Linux - docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn verify + docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-17 mvn verify ### Windows ```powershell -docker run -it --rm --name my-maven-project -v "$(Get-Location)":C:/Src -w C:/Src csanchez/maven:3.3-jdk-8-windows mvn verify +docker run -it --rm --name my-maven-project -v "$(Get-Location)":C:/Src -w C:/Src csanchez/maven:3.3-jdk-17-windows mvn verify ``` ### Windows ```powershell -docker run -it --rm --name my-maven-project -v "$(Get-Location)":C:/Src -w C:/Src maven:3.3-jdk-8-windows mvn clean install +docker run -it --rm --name my-maven-project -v "$(Get-Location)":C:/Src -w C:/Src maven:3.3-jdk-17-windows mvn clean install ``` ## Building local Docker image (optional) @@ -153,7 +153,7 @@ COPY . . RUN mvn -B -e -o -T 1C verify # package without maven -FROM openjdk +FROM eclipse-temurin:17-jdk COPY --from=0 /usr/src/app/target/*.jar ./ ``` @@ -343,7 +343,7 @@ Pester comes with most modern Windows (Windows 10 and Windows Server 2019), but ## Updating Maven version * Search and replace all references to the previous version by the new version. -* Update environment variable SHA in `eclipse-temurin-11/Dockerfile` with value found in [maven download page](https://maven.apache.org/download.cgi) for the binary tar.gz archive. +* Update environment variable SHA in `eclipse-temurin-17/Dockerfile` with value found in [maven download page](https://maven.apache.org/download.cgi) for the binary tar.gz archive. * Update environment variable SHA in `*-{nanoserver,windowsservercore}/Dockerfile` with value found in [maven download page](https://maven.apache.org/download.cgi) for the binary zip archive. ## Publishing to Docker Hub diff --git a/common.sh b/common.sh index 8cd7af21..eb3b8216 100755 --- a/common.sh +++ b/common.sh @@ -15,7 +15,7 @@ declare -A jdk_latest=( ["eclipse-temurin"]=$latest ["ibmjava"]="8" ["ibm-semeru"]="" - ["amazoncorretto"]="11" + ["amazoncorretto"]="17" ["libericaopenjdk"]="17" ["sapmachine"]="21" ["graalvm-community"]="21" diff --git a/publish.sh b/publish.sh index 9b84c2af..e7d89920 100755 --- a/publish.sh +++ b/publish.sh @@ -18,7 +18,7 @@ fi for dir in "${all_dirs[@]}"; do if [[ "$dir" == *"windows"* ]] || [[ "$dir" == *"nanoserver"* ]]; then - from=openjdk-11-windowsservercore + from=amazoncorretto-17-windowsservercore if [[ "$dir" != "$from" ]]; then cp $from/mvn-entrypoint.ps1 "$dir/" cp $from/settings-docker.xml "$dir/" diff --git a/tests/maven.Tests.ps1 b/tests/maven.Tests.ps1 index 1ffab5c5..608f319f 100644 --- a/tests/maven.Tests.ps1 +++ b/tests/maven.Tests.ps1 @@ -1,6 +1,6 @@ BeforeAll { $SUT_IMAGE="maven" - $SUT_TAG="openjdk-8-windowsservercore" + $SUT_TAG="amazoncorretto-17-windowsservercore" if(![System.String]::IsNullOrWhiteSpace($env:TAG)) { $SUT_TAG=$env:TAG } @@ -60,7 +60,7 @@ Describe "$SUT_TAG settings.xml is setup" { Describe "$SUT_TAG repository is created" { It 'created repository' { - $exitCode, $stdout, $stderr = Run-Program -Cmd "docker.exe" -Params "run --rm ${SUT_TEST_IMAGE}:${SUT_TAG} if(Test-Path C:/Users/ContainerUser/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar) { exit 0 } else {exit 1 }" + $exitCode, $stdout, $stderr = Run-Program -Cmd "docker.exe" -Params "run --rm ${SUT_TEST_IMAGE}:${SUT_TAG} if(Test-Path C:/Users/ContainerUser/.m2/repository/org/junit/junit-bom/5.7.2/junit-bom-5.7.2.pom) { exit 0 } else {exit 1 }" $exitCode | Should -Be 0 } } diff --git a/tests/tests.bats b/tests/tests.bats index 2e20188d..dcf3a52c 100644 --- a/tests/tests.bats +++ b/tests/tests.bats @@ -56,7 +56,7 @@ base_image=eclipse-temurin-17 } @test "$SUT_TAG repository is created" { - run docker run --rm $SUT_TEST_IMAGE:$SUT_TAG test -f /root/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar + run docker run --rm $SUT_TEST_IMAGE:$SUT_TAG test -f /root/.m2/repository/org/junit/junit-bom/5.7.2/junit-bom-5.7.2.pom assert_success }