Skip to content

(docs) Add moditect-maven-plugin as it is a less complex way for Java 8 with java module descriptors#1062

Open
bmarwell wants to merge 1 commit into
apache:masterfrom
bmarwell:docs-moditect
Open

(docs) Add moditect-maven-plugin as it is a less complex way for Java 8 with java module descriptors#1062
bmarwell wants to merge 1 commit into
apache:masterfrom
bmarwell:docs-moditect

Conversation

@bmarwell

@bmarwell bmarwell commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Adds the less complex moditect plugin to the module-info docs which is probably more helpful than compiling sources twice.


Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@bmarwell bmarwell requested a review from desruisseaux June 8, 2026 12:34
@desruisseaux

Copy link
Copy Markdown
Contributor

Actually the section saying that we need to run javac twice could be updated. It should not be needed any more since the addition of the multi-release support, although we would need to test for making sure. But in principle, a configuration like below should work with Java 8, with the module-info.java file in the src/main/java_9 directory:

    <sources>
      <source>
        <directory>src/main/java</directory>
        <targetVersion>8</targetVersion>
      </source>
      <source>
        <directory>src/main/java_9</directory>
        <targetVersion>9</targetVersion>
      </source>
    </sources>

We could amend the pull request so that instead of being "two compilations versus one compilation", make it "explicit module-info versus module-info derived from the pom.xml". We may need to test the above snippet first for making sure that it works in this context too.

@desruisseaux desruisseaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the approach described in above comment and it did not worked. It is a bit tricky to compile only a module-info.java file when everything else has been compiled as a class-path project. I just noticed that indeed, the existing text about using maven-compiler-plugin compiles the whole project twice. Therefore, I have no change to propose.

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.

3 participants