From 35419ae6300553b2e54a42f76bc9f7da13d45055 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 7 Nov 2025 12:55:42 +0800 Subject: [PATCH] build: Update minio-java build for JUnit 5 support Update minio-java install script to support JUnit 5, which is required by minio-java >= 8.6.0 (commit 044c33c481c67d7061b1f99ed0ea39fc06ac306b). Changes: - Update SPOTBUGS_VERSION from 4.2.2 to 4.8.6 (as per minio-java upgrade) - Replace JUnit 4 (4.12) with JUnit 5 (5.11.3) - Download JUnit 5 dependencies: - junit-jupiter-api: Test annotations (@Test, @BeforeEach, etc.) - junit-jupiter-engine: Test execution engine - junit-platform-commons: Platform utilities - junit-platform-engine: Test engine API - apiguardian-api: API version annotations - opentest4j: Test failure exceptions This matches the dependencies used in minio-java's build.gradle and allows Mint to compile and run tests with current minio-java versions. Removed the conditional JUnit 4/5 logic since Mint always fetches the latest minio-java version from Maven, which will always be >= 8.6.0. Signed-off-by: Kefu Chai --- build/minio-java/install.sh | 55 ++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/build/minio-java/install.sh b/build/minio-java/install.sh index 19e8c739..9b927454 100755 --- a/build/minio-java/install.sh +++ b/build/minio-java/install.sh @@ -15,8 +15,10 @@ # limitations under the License. # -SPOTBUGS_VERSION="4.2.2" ## needed since 8.0.2 release -JUNIT_VERSION="4.12" ## JUNIT version +SPOTBUGS_VERSION="4.8.6" ## SpotBugs annotations version +JUNIT_VERSION="5.11.3" ## JUnit 5 version +JUNIT_PLATFORM_VERSION="1.11.3" ## JUnit Platform version + MINIO_JAVA_VERSION=$(curl --retry 10 -s "https://repo1.maven.org/maven2/io/minio/minio/maven-metadata.xml" | sed -n "//{s/<.[^>]*>//g;p;q}" | sed "s/ *//g") if [ -z "$MINIO_JAVA_VERSION" ]; then echo "unable to get latest minio-java version from maven" @@ -29,10 +31,49 @@ git clone --quiet https://github.com/minio/minio-java.git "$test_run_dir/minio-j cd "$test_run_dir/minio-java.git" git checkout --quiet "tags/${MINIO_JAVA_VERSION}" ) -$WGET --output-document="$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar" "https://repo1.maven.org/maven2/io/minio/minio/${MINIO_JAVA_VERSION}/minio-${MINIO_JAVA_VERSION}-all.jar" -$WGET --output-document="$test_run_dir/minio-admin-${MINIO_JAVA_VERSION}-all.jar" "https://repo1.maven.org/maven2/io/minio/minio-admin/${MINIO_JAVA_VERSION}/minio-admin-${MINIO_JAVA_VERSION}-all.jar" -$WGET --output-document="$test_run_dir/spotbugs-annotations-${SPOTBUGS_VERSION}.jar" "https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/${SPOTBUGS_VERSION}/spotbugs-annotations-${SPOTBUGS_VERSION}.jar" -$WGET --output-document="$test_run_dir/junit-${JUNIT_VERSION}.jar" "https://repo1.maven.org/maven2/junit/junit/${JUNIT_VERSION}/junit-${JUNIT_VERSION}.jar" -javac -cp "$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar:$test_run_dir/minio-admin-${MINIO_JAVA_VERSION}-all.jar:$test_run_dir/spotbugs-annotations-${SPOTBUGS_VERSION}.jar:$test_run_dir/junit-${JUNIT_VERSION}.jar" "${test_run_dir}/minio-java.git/functional"/*.java + +# Download main dependencies +$WGET --output-document="$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar" \ + "https://repo1.maven.org/maven2/io/minio/minio/${MINIO_JAVA_VERSION}/minio-${MINIO_JAVA_VERSION}-all.jar" +$WGET --output-document="$test_run_dir/minio-admin-${MINIO_JAVA_VERSION}-all.jar" \ + "https://repo1.maven.org/maven2/io/minio/minio-admin/${MINIO_JAVA_VERSION}/minio-admin-${MINIO_JAVA_VERSION}-all.jar" +$WGET --output-document="$test_run_dir/spotbugs-annotations-${SPOTBUGS_VERSION}.jar" \ + "https://repo1.maven.org/maven2/com/github/spotbugs/spotbugs-annotations/${SPOTBUGS_VERSION}/spotbugs-annotations-${SPOTBUGS_VERSION}.jar" + +# Download JUnit 5 dependencies +$WGET --output-document="$test_run_dir/junit-jupiter-api-${JUNIT_VERSION}.jar" \ + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/${JUNIT_VERSION}/junit-jupiter-api-${JUNIT_VERSION}.jar" +$WGET --output-document="$test_run_dir/junit-jupiter-engine-${JUNIT_VERSION}.jar" \ + "https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/${JUNIT_VERSION}/junit-jupiter-engine-${JUNIT_VERSION}.jar" +$WGET --output-document="$test_run_dir/junit-platform-commons-${JUNIT_PLATFORM_VERSION}.jar" \ + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/${JUNIT_PLATFORM_VERSION}/junit-platform-commons-${JUNIT_PLATFORM_VERSION}.jar" +$WGET --output-document="$test_run_dir/junit-platform-engine-${JUNIT_PLATFORM_VERSION}.jar" \ + "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/${JUNIT_PLATFORM_VERSION}/junit-platform-engine-${JUNIT_PLATFORM_VERSION}.jar" + +# Download API Guardian (required by JUnit 5) +$WGET --output-document="$test_run_dir/apiguardian-api-1.1.2.jar" \ + "https://repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar" + +# Download OpenTest4J (required by JUnit 5) +$WGET --output-document="$test_run_dir/opentest4j-1.3.0.jar" \ + "https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar" + +# Build classpath +CLASSPATH="$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/minio-admin-${MINIO_JAVA_VERSION}-all.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/spotbugs-annotations-${SPOTBUGS_VERSION}.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/junit-jupiter-api-${JUNIT_VERSION}.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/junit-jupiter-engine-${JUNIT_VERSION}.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/junit-platform-commons-${JUNIT_PLATFORM_VERSION}.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/junit-platform-engine-${JUNIT_PLATFORM_VERSION}.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/apiguardian-api-1.1.2.jar" +CLASSPATH="$CLASSPATH:$test_run_dir/opentest4j-1.3.0.jar" + +# Compile tests +javac -cp "$CLASSPATH" "${test_run_dir}/minio-java.git/functional"/*.java + +# Copy compiled classes cp -a "${test_run_dir}/minio-java.git/functional"/*.class "$test_run_dir/" + +# Cleanup rm -fr "$test_run_dir/minio-java.git"