This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch branch_3x
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/branch_3x by this push:
new 0cbea24cd9 TIKA-5021: fail the build when a shipped dependency targets
a newer Java than its module (#3507)
0cbea24cd9 is described below
commit 0cbea24cd99be0ad72ddcb5cee166a438299956a
Author: Tim Allison <[email protected]>
AuthorDate: Mon Nov 2 12:32:47 2026 -0500
TIKA-5021: fail the build when a shipped dependency targets a newer Java
than its module (#3507)
---
CHANGES.txt | 4 +++
tika-parent/pom.xml | 31 ++++++++++++++++++++++
.../tika-parsers-ml/tika-age-recogniser/pom.xml | 4 +--
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 97241ba7fe..6d6e2e37bd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,9 @@
Release 3.4.0 - ???
+ * tika-age-recogniser runs on Java 11 again: hadoop is back on 3.4.3 (3.5.0,
in 3.3.3, needs
+ Java 17). The build now fails if a shipped dependency targets a newer Java
than its
+ module (enforceBytecodeVersion) (TIKA-5021).
+
* The SQLite and GeoPackage parsers quote table names when reading each
table; a
name that needed quoting failed the parse, and a crafted name ran as SQL.
diff --git a/tika-parent/pom.xml b/tika-parent/pom.xml
index b218510d62..c322914efc 100644
--- a/tika-parent/pom.xml
+++ b/tika-parent/pom.xml
@@ -1382,7 +1382,38 @@
<fail>true</fail>
</configuration>
</execution>
+ <!-- javac release N compiles against newer jars; fail here, not at
runtime with
+ UnsupportedClassVersionError -->
+ <execution>
+ <id>enforce-bytecode-version</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <enforceBytecodeVersion>
+ <maxJdkVersion>${maven.compiler.release}</maxJdkVersion>
+ <ignoredScopes>
+ <ignoredScope>test</ignoredScope>
+ <ignoredScope>provided</ignoredScope>
+ </ignoredScopes>
+ <ignoreClasses>
+ <!-- jline's FFM terminal (Java 22) loads only on runtimes
that support it -->
+ <ignoreClass>org.jline.terminal.impl.ffm.*</ignoreClass>
+ </ignoreClasses>
+ </enforceBytecodeVersion>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>extra-enforcer-rules</artifactId>
+ <version>1.12.1</version>
+ </dependency>
+ </dependencies>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
diff --git a/tika-parsers/tika-parsers-ml/tika-age-recogniser/pom.xml
b/tika-parsers/tika-parsers-ml/tika-age-recogniser/pom.xml
index 4fe41cc403..2b017afc5f 100644
--- a/tika-parsers/tika-parsers-ml/tika-age-recogniser/pom.xml
+++ b/tika-parsers/tika-parsers-ml/tika-age-recogniser/pom.xml
@@ -33,7 +33,7 @@
<properties>
<curator.version>5.9.0</curator.version>
- <hadoop.version>3.5.0</hadoop.version>
+ <hadoop.version>3.4.3</hadoop.version>
<jersey.version>2.48</jersey.version>
</properties>
@@ -253,7 +253,7 @@
<artifactId>java-xmlbuilder</artifactId>
<version>1.3</version>
</dependency>
- <!-- because of convergence errors with hadoop 3.5.0 -->
+ <!-- because of convergence errors with hadoop -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>