Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

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 module org.codehaus.plexus.interpolation with exports for all 7 public packages (interpolation, fixed, multi, object, os, reflection, util)

  • Updated pom.xml: Added a java9+ Maven profile that activates on JDK 9+ using multi-release JAR (MRJAR) approach:

    • Profile activates automatically when building with JDK 9 or higher via <jdk>[9,)</jdk>
    • compile-java9: Compiles module-info.java from src/main/java9/ with Java 9 and places it in META-INF/versions/9/
    • maven-jar-plugin: Configured to add Multi-Release: true to MANIFEST.MF
    • When building with JDK 8, the profile is inactive and module-info.java is skipped
    • No JDK toolchain configuration required

Result: 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.

module org.codehaus.plexus.interpolation {
    exports org.codehaus.plexus.interpolation;
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Add/generate module descriptor</issue_title>
<issue_description>this project has no dependencies and the manifest already contains Bundle info, so it should be a small step to also have the module-info.java</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI self-assigned this Nov 1, 2025
Copilot AI and others added 2 commits November 1, 2025 09:33
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add module descriptor to project Add module-info.java for JPMS support Nov 1, 2025
Copilot AI requested a review from slachiewicz November 1, 2025 09:37
Copilot finished work on behalf of slachiewicz November 1, 2025 09:37
Co-authored-by: slawekjaranowski <3578921+slawekjaranowski@users.noreply.github.com>
Copilot finished work on behalf of slawekjaranowski November 1, 2025 09:48
Copilot finished work on behalf of slawekjaranowski November 1, 2025 09:52
Co-authored-by: slawekjaranowski <3578921+slawekjaranowski@users.noreply.github.com>
Copilot AI changed the title Add module-info.java for JPMS support Add module-info.java for JPMS support using multi-release JAR Nov 1, 2025
Copilot finished work on behalf of slawekjaranowski November 1, 2025 09:59
Comment on lines 2 to 8
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;
Copy link
Member

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?

Copy link
Member

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

@slachiewicz slachiewicz marked this pull request as ready for review November 1, 2025 22:56
Removed multiple exports from the module definition.
@slachiewicz slachiewicz merged commit a414fed into master Nov 3, 2025
14 checks passed
@slachiewicz slachiewicz deleted the copilot/add-module-descriptor branch November 3, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add/generate module descriptor

4 participants