Skip to content

Commit

Permalink
chore: prepare tests for maven 4
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossg committed Aug 20, 2024
1 parent 03b409f commit 0682ec6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ./
```

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
4 changes: 2 additions & 2 deletions tests/maven.Tests.ps1
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 0682ec6

Please sign in to comment.