-
Notifications
You must be signed in to change notification settings - Fork 12
Add module-info.java for JPMS support using multi-release JAR #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Co-authored-by: slawekjaranowski <3578921+slawekjaranowski@users.noreply.github.com>
Co-authored-by: slawekjaranowski <3578921+slawekjaranowski@users.noreply.github.com>
src/main/java9/module-info.java
Outdated
| exports org.codehaus.plexus.interpolation; | ||
| exports org.codehaus.plexus.interpolation.fixed; | ||
| exports org.codehaus.plexus.interpolation.multi; | ||
| exports org.codehaus.plexus.interpolation.object; | ||
| exports org.codehaus.plexus.interpolation.os; | ||
| exports org.codehaus.plexus.interpolation.reflection; | ||
| exports org.codehaus.plexus.interpolation.util; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rfscholte @slachiewicz do we need export all packages ....?
eg org.codehaus.plexus.interpolation.os look like internal one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my hope was only org.codehaus.plexus.interpolation;
however, a quick scan through the Maven codebase:
DefaultToolchainsBuilderTest uses org.codehaus.plexus.interpolation.os.OperatingSystemUtils
PathTranslatingPostProcessor uses org.codehaus.plexus.interpolation.util.ValueSourceUtils
as long as Maven is not using the modulepath that's not an issue.
I would probably go for only org.codehaus.plexus.interpolation and investigate if there are requests for opening more packages
Removed multiple exports from the module definition.
Adds Java Platform Module System (JPMS) support via module-info.java while maintaining Java 8 compatibility using a multi-release JAR approach.
Changes
Created
src/main/java9/module-info.java: Declares moduleorg.codehaus.plexus.interpolationwith exports for all 7 public packages (interpolation, fixed, multi, object, os, reflection, util)Updated
pom.xml: Added ajava9+Maven profile that activates on JDK 9+ using multi-release JAR (MRJAR) approach:<jdk>[9,)</jdk>compile-java9: Compiles module-info.java fromsrc/main/java9/with Java 9 and places it inMETA-INF/versions/9/maven-jar-plugin: Configured to addMulti-Release: trueto MANIFEST.MFResult: When built with JDK 9+, a multi-release JAR is created with module-info.class in
META-INF/versions/9/(bytecode version 53) and all other classes remain Java 8 (bytecode version 52). When built with JDK 8, only Java 8 classes are produced. OSGi Bundle metadata in MANIFEST.MF unchanged.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.