Enh/update ext to build via java21#532
Open
dsaam94 wants to merge 2 commits intoknime-ip:enh/update-ext-to-build-via-java21from
Open
Enh/update ext to build via java21#532dsaam94 wants to merge 2 commits intoknime-ip:enh/update-ext-to-build-via-java21from
dsaam94 wants to merge 2 commits intoknime-ip:enh/update-ext-to-build-via-java21from
Conversation
Migrate KNIP extension build from Java 17 to Java 21 and update Apache Tycho from version 2.7.5 to 4.0.13 to support the new Java version. Changes: - Update pom.xml: * tycho.version: 2.7.5 → 4.0.13 * maven.compiler.source/target/release: 17 → 21 * tycho-compiler-plugin: Add release=21 with useJDK=BREE - Update all 8 MANIFEST.MF files: * Bundle-RequiredExecutionEnvironment: JavaSE-17 → JavaSE-21 * Require-Capability osgi.ee version: 17 → 21 (in org.knime.knip.io) This upgrade is necessary to leverage modern Java features and align with the evolving Java ecosystem. The useJDK=BREE configuration ensures that Tycho uses the correct JDK version matching the Bundle-RequiredExecutionEnvironment specified in the OSGi manifests. Note: This upgrade exposes a split package issue with org.w3c.dom that will be addressed in a subsequent commit.
After upgrading to Java 21 and Tycho 4.0.13, the build fails with a split
package error when compiling XMLCellViewFactory.java. The error occurs because
the org.w3c.dom package exists in both:
1. The xml-apis OSGi bundle (version 1.4.01.v201903040420)
2. The java.xml module in Java 21's module system
Compilation Error:
[ERROR] The package org.w3c.dom is accessible from more than one module:
<unnamed>, java.xml
[ERROR] /org.knime.knip.io/src/org/knime/knip/io/view/XMLCellViewFactory.java:[29]
import org.w3c.dom.Document;
^^^^^^^^^^^^^^^^^^^^
This is a split package problem that the Eclipse JDT compiler (embedded in
Tycho 4.0.13) cannot resolve. Java 21's module system strictly enforces that
a package can only come from one module, but OSGi bundles and Java modules
have different classloading models.
Attempted Solutions (all failed):
- Import-Package directives in MANIFEST.MF
- DynamicImport-Package configurations
- Module-specific --add-reads compiler arguments
- Fully qualified type names
- useJDK=SYSTEM with javac compiler
- Various Eclipse JDT compiler warnings/errors suppression flags
- .settings/org.eclipse.jdt.core.prefs configurations
- Removing xml-apis from Require-Bundle
Workaround:
Since XMLCellViewFactory provides tree view rendering for XML cell values
(a non-critical feature), we disable it to unblock the Java 21 migration:
1. Comment out the extension registration in plugin.xml to prevent the
class from being loaded at runtime
2. Rename XMLCellViewFactory.java to .java.disabled to prevent compilation
Impact:
- XML tree view feature unavailable in KNIME table views
- All other KNIP functionality remains intact
- Future resolution: Re-enable when Tycho/Eclipse JDT adds proper split
package handling between OSGi bundles and Java modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.