Skip to content

Commit 271ca6d

Browse files
authored
Merge pull request #924 from hazendaz/master
Various build updates in prep for next release
2 parents c4eb75a + c3c9e6f commit 271ca6d

File tree

11 files changed

+97
-69
lines changed

11 files changed

+97
-69
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,33 @@ name: Java CI
22

33
on: [workflow_dispatch, push, pull_request]
44

5+
permissions: read-all
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
511
jobs:
612
test:
713
runs-on: ${{ matrix.os }}
14+
timeout-minutes: 30
815
strategy:
916
matrix:
1017
cache: [maven]
1118
distribution: [temurin]
12-
java: [17, 21, 24, 25-ea]
13-
os: [ubuntu-latest, macos-latest, windows-latest]
19+
java: [17, 21, 25-ea, 26-ea]
20+
os: [macos-latest, ubuntu-latest, windows-latest]
1421
fail-fast: false
15-
max-parallel: 4
22+
max-parallel: 6
1623
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
1724

1825
steps:
19-
- uses: actions/checkout@v5
20-
- name: Set up JDK ${{ matrix.java }} ${{ matrix.distribution }}
21-
uses: actions/setup-java@v5
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
27+
- name: Setup Java ${{ matrix.java }} ${{ matrix.distribution }}
28+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
2229
with:
23-
java-version: ${{ matrix.java }}
24-
distribution: ${{ matrix.distribution }}
2530
cache: ${{ matrix.cache }}
31+
distribution: ${{ matrix.distribution }}
32+
java-version: ${{ matrix.java }}
2633
- name: Test with Maven
27-
run: ./mvnw test -B -V --no-transfer-progress -D"license.skip=true"
34+
run: ./mvnw test --batch-mode --no-transfer-progress --show-version -D"license.skip=true"

.github/workflows/site.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ on:
88
permissions:
99
contents: write
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
build:
1317
if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
1418
runs-on: ubuntu-latest
19+
timeout-minutes: 30
1520
steps:
16-
- uses: actions/checkout@v5
17-
- name: Set up JDK
18-
uses: actions/setup-java@v5
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
22+
- name: Setup Java
23+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
1924
with:
2025
cache: maven
2126
distribution: temurin
2227
java-version: 21
2328
- name: Build site
24-
run: ./mvnw site site:stage -DskipTests -Dlicense.skip=true -B -V --no-transfer-progress --settings ./.mvn/settings.xml
29+
run: ./mvnw site site:stage --batch-mode --no-transfer-progress --settings ./.mvn/settings.xml --show-version -Dlicense.skip=true -DskipTests
2530
env:
2631
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2732
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
2833
- name: Deploy Site to gh-pages
29-
uses: JamesIves/github-pages-deploy-action@v4
34+
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4
3035
with:
3136
branch: gh-pages
3237
folder: target/staging

.github/workflows/sonar.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@ on:
55
branches:
66
- master
77

8+
permissions: read-all
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
814
jobs:
915
build:
1016
if: github.repository_owner == 'mybatis'
1117
runs-on: ubuntu-latest
18+
timeout-minutes: 30
1219
steps:
13-
- uses: actions/checkout@v5
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1421
with:
1522
# Disabling shallow clone is recommended for improving relevancy of reporting
1623
fetch-depth: 0
17-
- name: Set up JDK
18-
uses: actions/setup-java@v5
24+
- name: Setup Java
25+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
1926
with:
2027
cache: maven
2128
distribution: temurin
2229
java-version: 21
30+
- name: Set SONAR_SCANNER_JAVA_OPTS
31+
run: echo "SONAR_SCANNER_JAVA_OPTS=-Xmx512m" >> $GITHUB_ENV
2332
- name: Analyze with SonarCloud
24-
run: ./mvnw verify sonar:sonar -B -V -Dsonar.projectKey=mybatis_parent -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dlicense.skip=true --no-transfer-progress
33+
run: ./mvnw verify jacoco:report sonar:sonar --batch-mode --no-transfer-progress --show-version -Dlicense.skip=true -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mybatis_parent -Dsonar.projectKey=mybatis -Dsonar.scanner.skipJreProvisioning=true -Dsonar.token=$SONAR_TOKEN
2534
env:
2635
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2736
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonatype.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ on:
55
branches:
66
- master
77

8+
permissions: read-all
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
814
jobs:
915
build:
1016
if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
1117
runs-on: ubuntu-latest
18+
timeout-minutes: 30
1219
steps:
13-
- uses: actions/checkout@v5
14-
- name: Set up JDK
15-
uses: actions/setup-java@v5
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
21+
- name: Setup Java
22+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
1623
with:
1724
cache: maven
1825
distribution: temurin
1926
java-version: 21
2027
- name: Deploy to Sonatype
21-
run: ./mvnw deploy -DskipTests -B -V --no-transfer-progress --settings ./.mvn/settings.xml -Dlicense.skip=true
28+
run: ./mvnw deploy --batch-mode --no-transfer-progress --settings ./.mvn/settings.xml --show-version -Dlicense.skip=true -DskipTests
2229
env:
2330
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
2431
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}

.mvn/jvm.config

Whitespace-only changes.

.mvn/maven.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
-Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5
22
-Daether.connector.smartChecksums=false
3+
--no-transfer-progress

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525
import java.net.URL;
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
28-
import java.nio.file.Paths;
2928
import java.nio.file.StandardCopyOption;
3029
import java.util.concurrent.ThreadLocalRandom;
3130

3231
public final class MavenWrapperDownloader {
33-
private static final String WRAPPER_VERSION = "3.3.2";
32+
private static final String WRAPPER_VERSION = "3.3.4";
3433

3534
private static final boolean VERBOSE = Boolean.parseBoolean(System.getenv("MVNW_VERBOSE"));
3635

@@ -45,8 +44,11 @@ public static void main(String[] args) {
4544
try {
4645
log(" - Downloader started");
4746
final URL wrapperUrl = URI.create(args[0]).toURL();
48-
final String jarPath = args[1].replace("..", ""); // Sanitize path
49-
final Path wrapperJarPath = Paths.get(jarPath).toAbsolutePath().normalize();
47+
final Path baseDir = Path.of(".").toAbsolutePath().normalize();
48+
final Path wrapperJarPath = baseDir.resolve(args[1]).normalize();
49+
if (!wrapperJarPath.startsWith(baseDir)) {
50+
throw new IOException("Invalid path: outside of allowed directory");
51+
}
5052
downloadFileFromURL(wrapperUrl, wrapperJarPath);
5153
log("Done");
5254
} catch (IOException e) {
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
wrapperVersion=3.3.2
181
distributionType=source
192
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
20-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
3+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar
4+
wrapperVersion=3.3.4

mvnw

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# ----------------------------------------------------------------------------
2020

2121
# ----------------------------------------------------------------------------
22-
# Apache Maven Wrapper startup batch script, version 3.3.2
22+
# Apache Maven Wrapper startup batch script, version 3.3.4
2323
#
2424
# Required ENV vars:
2525
# ------------------
@@ -201,6 +201,14 @@ MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
201201
export MAVEN_PROJECTBASEDIR
202202
log "$MAVEN_PROJECTBASEDIR"
203203

204+
trim() {
205+
# MWRAPPER-139:
206+
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
207+
# Needed for removing poorly interpreted newline sequences when running in more
208+
# exotic environments such as mingw bash on Windows.
209+
printf "%s" "${1}" | tr -d '[:space:]'
210+
}
211+
204212
##########################################################################################
205213
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
206214
# This allows using the maven wrapper in projects that prohibit checking in binary data.
@@ -212,15 +220,13 @@ else
212220
log "Couldn't find $wrapperJarPath, downloading it ..."
213221

214222
if [ -n "$MVNW_REPOURL" ]; then
215-
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
223+
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
216224
else
217-
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
225+
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
218226
fi
219227
while IFS="=" read -r key value; do
220-
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
221-
safeValue=$(echo "$value" | tr -d '\r')
222228
case "$key" in wrapperUrl)
223-
wrapperUrl="$safeValue"
229+
wrapperUrl=$(trim "${value-}")
224230
break
225231
;;
226232
esac
@@ -235,17 +241,17 @@ else
235241
log "Found wget ... using wget"
236242
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
237243
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
238-
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
244+
wget ${QUIET:+"$QUIET"} "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
239245
else
240-
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
246+
wget ${QUIET:+"$QUIET"} --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
241247
fi
242248
elif command -v curl >/dev/null; then
243249
log "Found curl ... using curl"
244250
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
245251
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
246-
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
252+
curl ${QUIET:+"$QUIET"} -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
247253
else
248-
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
254+
curl ${QUIET:+"$QUIET"} --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
249255
fi
250256
else
251257
log "Falling back to using Java to download"
@@ -276,15 +282,15 @@ fi
276282
wrapperSha256Sum=""
277283
while IFS="=" read -r key value; do
278284
case "$key" in wrapperSha256Sum)
279-
wrapperSha256Sum=$value
285+
wrapperSha256Sum=$(trim "${value-}")
280286
break
281287
;;
282288
esac
283289
done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
284290
if [ -n "$wrapperSha256Sum" ]; then
285291
wrapperSha256Result=false
286292
if command -v sha256sum >/dev/null; then
287-
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then
293+
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c - >/dev/null 2>&1; then
288294
wrapperSha256Result=true
289295
fi
290296
elif command -v shasum >/dev/null; then
@@ -321,6 +327,8 @@ fi
321327
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
322328
export MAVEN_CMD_LINE_ARGS
323329

330+
# Maven main class is here to fix maven 4.0.0-beta-5 through 4.0.0-rc-4
331+
MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling
324332
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
325333

326334
# shellcheck disable=SC2086 # safe args
@@ -329,4 +337,5 @@ exec "$JAVACMD" \
329337
$MAVEN_DEBUG_OPTS \
330338
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
331339
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
340+
"-Dmaven.mainClass=${MAVEN_MAIN_CLASS}" \
332341
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

mvnw.cmd

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@REM ----------------------------------------------------------------------------
1919

2020
@REM ----------------------------------------------------------------------------
21-
@REM Apache Maven Wrapper startup batch script, version 3.3.2
21+
@REM Apache Maven Wrapper startup batch script, version 3.3.4
2222
@REM
2323
@REM Required ENV vars:
2424
@REM JAVA_HOME - location of a JDK home dir
@@ -117,9 +117,12 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
117117

118118
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
119119
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120+
121+
@REM Maven main class is here to fix maven 4.0.0-beta-5 through 4.0.0-rc-4
122+
set MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling
120123
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121124

122-
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
125+
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
123126

124127
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
125128
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
@@ -133,20 +136,20 @@ if exist %WRAPPER_JAR% (
133136
)
134137
) else (
135138
if not "%MVNW_REPOURL%" == "" (
136-
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
139+
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
137140
)
138141
if "%MVNW_VERBOSE%" == "true" (
139142
echo Couldn't find %WRAPPER_JAR%, downloading it ...
140143
echo Downloading from: %WRAPPER_URL%
141144
)
142145

143146
powershell -Command "&{"^
144-
"$webclient = new-object System.Net.WebClient;"^
145-
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
146-
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
147-
"}"^
148-
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
149-
"}"
147+
"$webclient = new-object System.Net.WebClient;"^
148+
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
149+
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
150+
"}"^
151+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
152+
"}"
150153
if "%MVNW_VERBOSE%" == "true" (
151154
echo Finished downloading %WRAPPER_JAR%
152155
)
@@ -182,6 +185,7 @@ set MAVEN_CMD_LINE_ARGS=%*
182185
%MAVEN_DEBUG_OPTS% ^
183186
-classpath %WRAPPER_JAR% ^
184187
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
188+
"-Dmaven.mainClass=%MAVEN_MAIN_CLASS%" ^
185189
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
186190
if ERRORLEVEL 1 goto error
187191
goto end

0 commit comments

Comments
 (0)