From 8275b184c193919174069de2f7ae81ac3d8f5062 Mon Sep 17 00:00:00 2001 From: Andy Li <1450947+andy1li@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:01:35 +0900 Subject: [PATCH] Update Java version to 25 and enable preview features in build configuration - Changed buildpack version from java-24 to java-25 in configuration files. - Updated Maven compiler source and target versions to 25 in pom.xml files. - Added maven-compiler-plugin configuration to enable preview features. - Modified run scripts to include the --enable-preview flag for Java execution. - Introduced a new Dockerfile for Java 25. --- compiled_starters/java/.codecrafters/run.sh | 2 +- compiled_starters/java/codecrafters.yml | 4 ++-- compiled_starters/java/pom.xml | 15 ++++++++++++--- compiled_starters/java/your_program.sh | 2 +- dockerfiles/java-25.Dockerfile | 13 +++++++++++++ solutions/java/01-dr6/code/.codecrafters/run.sh | 2 +- solutions/java/01-dr6/code/codecrafters.yml | 4 ++-- solutions/java/01-dr6/code/pom.xml | 15 ++++++++++++--- solutions/java/01-dr6/code/your_program.sh | 2 +- starter_templates/java/code/.codecrafters/run.sh | 2 +- starter_templates/java/code/pom.xml | 15 ++++++++++++--- 11 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 dockerfiles/java-25.Dockerfile diff --git a/compiled_starters/java/.codecrafters/run.sh b/compiled_starters/java/.codecrafters/run.sh index f924857..eca24f3 100755 --- a/compiled_starters/java/.codecrafters/run.sh +++ b/compiled_starters/java/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" +exec java --enable-preview -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" diff --git a/compiled_starters/java/codecrafters.yml b/compiled_starters/java/codecrafters.yml index 510bd84..a08b71c 100644 --- a/compiled_starters/java/codecrafters.yml +++ b/compiled_starters/java/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Java version used to run your code # on Codecrafters. # -# Available versions: java-24 -buildpack: java-24 +# Available versions: java-25 +buildpack: java-25 diff --git a/compiled_starters/java/pom.xml b/compiled_starters/java/pom.xml index da20483..4bc74d4 100644 --- a/compiled_starters/java/pom.xml +++ b/compiled_starters/java/pom.xml @@ -9,14 +9,23 @@ 1.0 - 23 - 23 + 25 + 25 UTF-8 - 23 + 25 + + org.apache.maven.plugins + maven-compiler-plugin + + + --enable-preview + + + org.apache.maven.plugins maven-assembly-plugin diff --git a/compiled_starters/java/your_program.sh b/compiled_starters/java/your_program.sh index d8a0bfc..cca5838 100755 --- a/compiled_starters/java/your_program.sh +++ b/compiled_starters/java/your_program.sh @@ -21,4 +21,4 @@ set -e # Exit early if any commands fail # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec java -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" +exec java --enable-preview -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" diff --git a/dockerfiles/java-25.Dockerfile b/dockerfiles/java-25.Dockerfile new file mode 100644 index 0000000..0ef868e --- /dev/null +++ b/dockerfiles/java-25.Dockerfile @@ -0,0 +1,13 @@ +# syntax=docker/dockerfile:1.7-labs +FROM maven:3.9.11-eclipse-temurin-25-alpine + +# Ensures the container is re-built if dependency files change +ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="pom.xml" + +WORKDIR /app + +# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses +COPY --exclude=.git --exclude=README.md . /app + +# Install language-specific dependencies +RUN .codecrafters/compile.sh diff --git a/solutions/java/01-dr6/code/.codecrafters/run.sh b/solutions/java/01-dr6/code/.codecrafters/run.sh index f924857..eca24f3 100755 --- a/solutions/java/01-dr6/code/.codecrafters/run.sh +++ b/solutions/java/01-dr6/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" +exec java --enable-preview -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" diff --git a/solutions/java/01-dr6/code/codecrafters.yml b/solutions/java/01-dr6/code/codecrafters.yml index 510bd84..a08b71c 100644 --- a/solutions/java/01-dr6/code/codecrafters.yml +++ b/solutions/java/01-dr6/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Java version used to run your code # on Codecrafters. # -# Available versions: java-24 -buildpack: java-24 +# Available versions: java-25 +buildpack: java-25 diff --git a/solutions/java/01-dr6/code/pom.xml b/solutions/java/01-dr6/code/pom.xml index da20483..4bc74d4 100644 --- a/solutions/java/01-dr6/code/pom.xml +++ b/solutions/java/01-dr6/code/pom.xml @@ -9,14 +9,23 @@ 1.0 - 23 - 23 + 25 + 25 UTF-8 - 23 + 25 + + org.apache.maven.plugins + maven-compiler-plugin + + + --enable-preview + + + org.apache.maven.plugins maven-assembly-plugin diff --git a/solutions/java/01-dr6/code/your_program.sh b/solutions/java/01-dr6/code/your_program.sh index d8a0bfc..cca5838 100755 --- a/solutions/java/01-dr6/code/your_program.sh +++ b/solutions/java/01-dr6/code/your_program.sh @@ -21,4 +21,4 @@ set -e # Exit early if any commands fail # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec java -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" +exec java --enable-preview -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" diff --git a/starter_templates/java/code/.codecrafters/run.sh b/starter_templates/java/code/.codecrafters/run.sh index f924857..eca24f3 100755 --- a/starter_templates/java/code/.codecrafters/run.sh +++ b/starter_templates/java/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" +exec java --enable-preview -jar /tmp/codecrafters-build-sqlite-java/codecrafters-sqlite.jar "$@" diff --git a/starter_templates/java/code/pom.xml b/starter_templates/java/code/pom.xml index da20483..4bc74d4 100644 --- a/starter_templates/java/code/pom.xml +++ b/starter_templates/java/code/pom.xml @@ -9,14 +9,23 @@ 1.0 - 23 - 23 + 25 + 25 UTF-8 - 23 + 25 + + org.apache.maven.plugins + maven-compiler-plugin + + + --enable-preview + + + org.apache.maven.plugins maven-assembly-plugin