Add JDT classpath attribute support for multi-release JAR compilation#5627
Merged
Add JDT classpath attribute support for multi-release JAR compilation#5627
Conversation
Copilot
AI
changed the title
[WIP] Enhance multi-release jar support in Tycho
Add JDT classpath attribute support for multi-release JAR compilation
Nov 18, 2025
laeubi
reviewed
Nov 19, 2025
tycho-compiler-plugin/src/main/java/org/eclipse/tycho/compiler/AbstractOsgiCompilerMojo.java
Show resolved
Hide resolved
...tadata-model/src/main/java/org/eclipse/tycho/model/classpath/SourceFolderClasspathEntry.java
Outdated
Show resolved
Hide resolved
tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java
Outdated
Show resolved
Hide resolved
Contributor
Author
All review comments have been addressed in commit 866687c. The changes include:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
866687c to
8ae7d26
Compare
8ae7d26 to
3102a55
Compare
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
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.
Implements support for Eclipse JDT's
releaseclasspath attribute (introduced in Eclipse 4.38) to enable multi-release JAR compilation with flexible source folder naming and without requiring supplemental manifests.Changes
Core Implementation
SourceFolderClasspathEntry: AddedgetMultiReleaseVersion()method returningOptionalIntto extract Java version fromreleaseclasspath attributeAbstractOsgiCompilerMojo: EnhanceddoCompile()to check forMulti-Release: truemanifest header first, then detect classpath entries withreleaseattributes, compile them with appropriate--releaseflags, and output toMETA-INF/versions/N/directories. Falls back to directory-based approach for backward compatibility.Multi-Release: trueheader must be explicitly set in the manifest as a prerequisite to enable the featureExample
.classpathfile marking source folders for specific Java versions:Note: Source folders can be named flexibly (e.g.,
src_java9,java11-src). The version is determined by thereleaseattribute value, not the folder name.Required manifest configuration:
Resulting JAR structure:
Key Features
Multi-Release: trueheader is required as the primary triggerreleaseattributeMETA-INF/versions/N/OSGI-INF/are requiredsrcNnaming) if no classpath attributes foundDemo & Documentation
demo/multi-release-jar-classpath/: Reference implementation using classpath attribute approachBuildingMultiReleaseBundles.md: Comprehensive guide covering JEP 238, OSGi R8 spec, both approaches (classpath vs manifest-first), and best practicesDemoTest: Added integration test for classpath-based demoReferences
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.