Skip to content

Commit 72d3998

Browse files
committed
fix: restore Java 11/17 compatibility and add robust Makefile
- Use Grizzly 4.0.2 for Java 11/17 and 5.0.0 for Java 21+. - Add Makefile for testing against all supported JDKs with version validation. - Include JDK-specific Error Prone versions and flags for JDK 21+.
1 parent 9763ea8 commit 72d3998

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
JDK_VERSIONS := 11 17 21
2+
3+
.PHONY: help
4+
help:
5+
@echo "Usage:"
6+
@echo " make test - Run full tests (clean verify) on all supported JDKs ($(JDK_VERSIONS))"
7+
@echo " make compile - Run clean compile on all supported JDKs ($(JDK_VERSIONS))"
8+
@echo " make version - Show current project version"
9+
@echo " make test-jdk-XX - Run tests on a specific JDK version (e.g., make test-jdk-11)"
10+
11+
.PHONY: version
12+
version:
13+
@mvn help:evaluate -Dexpression=project.version -q -DforceStdout
14+
@echo
15+
16+
.PHONY: test
17+
test: $(addprefix test-jdk-,$(JDK_VERSIONS))
18+
19+
.PHONY: compile
20+
compile: $(addprefix compile-jdk-,$(JDK_VERSIONS))
21+
22+
test-jdk-%:
23+
@echo "------------------------------------------------------------"
24+
@echo "Testing with JDK $*..."
25+
@actual_home=$$(/usr/libexec/java_home -v $* 2>/dev/null); \
26+
actual_version=$$([ -n "$$actual_home" ] && "$$actual_home/bin/java" -XshowSettings:properties -version 2>&1 | grep "java.specification.version" | awk '{print $$3}' | tr -d '"'); \
27+
if [ "$$actual_version" != "$*" ]; then \
28+
brew_path=$$(brew --prefix openjdk@$* 2>/dev/null); \
29+
if [ -n "$$brew_path" ] && [ -d "$$brew_path/libexec/openjdk.jdk/Contents/Home" ]; then \
30+
actual_home="$$brew_path/libexec/openjdk.jdk/Contents/Home"; \
31+
actual_version=$$("$$actual_home/bin/java" -XshowSettings:properties -version 2>&1 | grep "java.specification.version" | awk '{print $$3}' | tr -d '"'); \
32+
fi; \
33+
fi; \
34+
if [ "$$actual_version" != "$*" ]; then \
35+
echo "ERROR: JDK $* not found or not active."; \
36+
echo "To install it, run: brew install openjdk@$*"; \
37+
exit 1; \
38+
fi; \
39+
export JAVA_HOME="$$actual_home"; \
40+
mvn -version; \
41+
mvn clean verify -Dgpg.skip
42+
43+
compile-jdk-%:
44+
@echo "------------------------------------------------------------"
45+
@echo "Compiling with JDK $*..."
46+
@actual_home=$$(/usr/libexec/java_home -v $* 2>/dev/null); \
47+
actual_version=$$([ -n "$$actual_home" ] && "$$actual_home/bin/java" -XshowSettings:properties -version 2>&1 | grep "java.specification.version" | awk '{print $$3}' | tr -d '"'); \
48+
if [ "$$actual_version" != "$*" ]; then \
49+
brew_path=$$(brew --prefix openjdk@$* 2>/dev/null); \
50+
if [ -n "$$brew_path" ] && [ -d "$$brew_path/libexec/openjdk.jdk/Contents/Home" ]; then \
51+
actual_home="$$brew_path/libexec/openjdk.jdk/Contents/Home"; \
52+
actual_version=$$("$$actual_home/bin/java" -XshowSettings:properties -version 2>&1 | grep "java.specification.version" | awk '{print $$3}' | tr -d '"'); \
53+
fi; \
54+
fi; \
55+
if [ "$$actual_version" != "$*" ]; then \
56+
echo "ERROR: JDK $* not found or not active."; \
57+
echo "To install it, run: brew install openjdk@$*"; \
58+
exit 1; \
59+
fi; \
60+
export JAVA_HOME="$$actual_home"; \
61+
mvn -version; \
62+
mvn clean compile

pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<dependency>
128128
<groupId>org.glassfish.grizzly</groupId>
129129
<artifactId>grizzly-http-server</artifactId>
130-
<version>5.0.0</version>
130+
<version>4.0.2</version>
131131
</dependency>
132132
</dependencies>
133133
</dependencyManagement>
@@ -836,6 +836,15 @@
836836
<properties>
837837
<error.prone.version>2.48.0</error.prone.version>
838838
</properties>
839+
<dependencyManagement>
840+
<dependencies>
841+
<dependency>
842+
<groupId>org.glassfish.grizzly</groupId>
843+
<artifactId>grizzly-http-server</artifactId>
844+
<version>5.0.0</version>
845+
</dependency>
846+
</dependencies>
847+
</dependencyManagement>
839848
<build>
840849
<pluginManagement>
841850
<plugins>

0 commit comments

Comments
 (0)