tcurdt / jdeb

This library provides an Ant task and a Maven plugin to create Debian packages from Java builds in a truly cross platform manner.
https://github.com/tcurdt/jdeb
Apache License 2.0
533 stars 317 forks source link

Java 8 support? #809

Closed ebourg closed 1 month ago

ebourg commented 1 month ago

I use jdeb in a project supporting Java 8 (Jsign) but the latest version of jdeb requires Java 11. It looks like the only thing requiring Java 11 is a test case using List.of(). Do you mind if I replace it with Arrays.asList() to restore the compatibility with Java 8?

diff --git a/pom.xml b/pom.xml
index 1b94cb9..ea90979 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,9 +3,9 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    <maven.compiler.source>11</maven.compiler.source>
-    <maven.compiler.target>11</maven.compiler.target>
-    <maven.compiler.release>11</maven.compiler.release>
+    <maven.compiler.source>8</maven.compiler.source>
+    <maven.compiler.target>8</maven.compiler.target>
+    <maven.compiler.release>8</maven.compiler.release>
     <maven.scope>provided</maven.scope>
     <maven.version>3.9.8</maven.version>
     <maven.plugin.version>3.15.1</maven.plugin.version>
diff --git a/src/test/java/org/vafer/jdeb/DebMakerTestCase.java b/src/test/java/org/vafer/jdeb/DebMakerTestCase.java
index 61ae8fc..7d1acd8 100644
--- a/src/test/java/org/vafer/jdeb/DebMakerTestCase.java
+++ b/src/test/java/org/vafer/jdeb/DebMakerTestCase.java
@@ -505,7 +505,7 @@ public final class DebMakerTestCase extends Assert {
     @Test
     public void testErrorPropagation() throws Exception {
         File deb = File.createTempFile("jdeb", ".deb");
-        DebMaker maker = new DebMaker(new NullConsole(), List.of(new UseNullAsInputStream()), null);
+        DebMaker maker = new DebMaker(new NullConsole(), Arrays.asList(new UseNullAsInputStream()), null);
         maker.setEncoding(StandardCharsets.UTF_8);
         maker.setControl(new File(getClass().getResource("deb/control").toURI()));
         maker.setDeb(deb);
@@ -526,7 +526,7 @@ public final class DebMakerTestCase extends Assert {
         File changesSave = File.createTempFile("changesSave", ".txt");
         File directory = new File(getClass().getResource("deb/data").toURI());

-        DebMaker maker = new DebMaker(new NullConsole(), List.of(new UseNullAsInputStream()), null);
+        DebMaker maker = new DebMaker(new NullConsole(), Arrays.asList(new UseNullAsInputStream()), null);
         maker.setEncoding(StandardCharsets.UTF_8);
         assertThrows(PackagingException.class, maker::validate);
tcurdt commented 1 month ago

While I sure don't mind if it helps you, I am not sure how I feel about support java 8 for the future. IIRC it was EOL in 2019. That's quite a while ago. I am not eager re-include support for the ancient.

ebourg commented 1 month ago

Thank you. The 2019 EOL was for the Oracle JDK, but Red Hat keeps maitaining OpenJDK 8 until the end of 2026 (and even 2030 for paid updates). Java 8 is still used by 25-30% of projects, that's still significant (fortunately or unfortunately, but difficult to ignore for a build tool).