Skip to content

Commit a29f287

Browse files
committed
checkstyle: fix broken build
The Maven build configuration of the Checkstyle project requires Java 21 or a higher version. However, the default OSS-Fuzz base image provides Java 17, resulting in a mismatch error regarding the Java version.
1 parent 583430e commit a29f287

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

projects/checkstyle/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ RUN curl -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-
1818
-o maven.zip && \
1919
unzip maven.zip -d $SRC/maven && \
2020
rm maven.zip
21-
ENV MVN $SRC/maven/apache-maven-3.6.3/bin/mvn
21+
ENV MVN=$SRC/maven/apache-maven-3.6.3/bin/mvn
22+
RUN apt-get update && apt-get install -y openjdk-21-jdk \
23+
&& update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java \
24+
&& update-alternatives --set javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac
25+
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
26+
ENV PATH="$JAVA_HOME/bin:$PATH"
2227
RUN git clone --depth 1 https://github.com/checkstyle/checkstyle checkstyle
2328
COPY *.sh *Fuzzer.java $SRC/
2429
WORKDIR $SRC/checkstyle

projects/checkstyle/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
##########################################################################
1717
export TARGET_PACKAGE_PREFIX="com.puppycrawl.tools.checkstyle."
1818

19-
MAVEN_ARGS="-Dmaven.test.skip=true -Djavac.src.version=15 -Djavac.target.version=15 --update-snapshots"
19+
MAVEN_ARGS="-Dmaven.test.skip=true -Djavac.src.version=21 -Djavac.target.version=21 --update-snapshots"
2020
$MVN clean package $MAVEN_ARGS
2121

2222
BUILD_CLASSPATH=

0 commit comments

Comments
 (0)