Add module-info via moditect-maven-plugin, compile to java 8#20
Conversation
Removes Automatic-Module-Name manifest entry and replaces it with module-info via multi-version jar
|
Since #19 is now closed, I want to make sure to emphasize the order to merge and release this PR before #21:
I believe it is important to have a Java 8 compatible modularized version of this library, as many downstream libs still target Java 8. |
| </goals> | ||
| <configuration> | ||
| <module> | ||
| <moduleInfoFile>src/main/java9/module-info.java</moduleInfoFile> |
There was a problem hiding this comment.
I think other specs put this files under src/main/java (see here)
There was a problem hiding this comment.
Can we follow the same convention?
There was a problem hiding this comment.
yasson is already on Java 9. Java 8's javac would choke on this file, if it tried to compile it. Therefore, the multi-version layout is required.
There was a problem hiding this comment.
Yea putting this into java9 (or module or something) is the right thing to do here, as we want to build the main source with Java 8.
Ladicek
left a comment
There was a problem hiding this comment.
I believe this is exactly what we want -- build the main source with Java 8, produce a Java 8 compatible JAR, but also include module-info.class.
|
Are we sure, we don't need to set |
|
Pretty sure we don't have to set the To the best of my knowledge, Java 8 has no reason to load the |
One should not access it, however some build tools seem to be too fancy to adhere specs: See google/guava#2970 (comment) (and the following discussion) |
I note that Jackson has module-info without MR jar so I suspect problems with this approach have to be very rare indeed - but that all said, the more conservative and safe approach is to modify this PR back to use Multi-release Jar and I'm happy to do that, it's a one line change to this PR. So, shall we go a touch more conservative and use MR jar? Edit: Is everyone happy using MR jar? Any reason not to approve this PR? |
Will package with module-info.class in META-INF/versions/9/module-info.class
|
Frankly, if there's a tool that finds and uses |
|
That said, there's nothing wrong with this approach, and there's no extra complexity in the build, so if this is what everyone wants, I'm fine with it too. |
You're probably right. Also, Jackson (as mentioned above) strongly indicates that in the meantime most tools should be fixed. But if MR-Jars were even slightly more forgiving, it might make a difference for other library vendors, that would otherwise not dare to update |
|
Maybe just looking for approvals then @Emily-Jiang @overheadhunter @Ladicek ? |
IIRC, the file structure is pretty much MR jar layout. I found it is confusing not to state it is a MR jar but place module-info.class using the MR layout (my earlier comment reflected my confusion since I thought it was not a MR jar). I am not sure the module-info.class can be easily loaded by Java 9+ at all. I think it is safer to set as a MR jar and be done with it. |
|
This PR originally produced a MR JAR. Then it wasn't a MR JAR (which is when I approved and also wrote that comment), and now it is a MR JAR again. |
Hi @Emily-Jiang , as @Ladicek has pointed out this produces a MR jar. To explain that a little more, this is compiling to Java 8 bytecode. We can't use the JDK8 javac to compile module-info.java obviously. Instead this uses the Personally, I have used the Thanks, Rob. |
This comment has been minimized.
This comment has been minimized.
|
@pzygielo done, title updated. |
Thank you @rbygrave for your detail explanation! Let me relay to see whether I understood this correctly. You said it is not a MR jar because there is no |
There is only one module-info.class in the jar and yes it is located at
In the resulting That is, if we pull this branch and
Correct, there is no duplicated module-info class @Emily-Jiang |
This is what I thought as a MR jar. Then I read @Ladicek 's comments , which he hinted he approved with a non-MR jar approach. I might completely misunderstood what it meant. However, I am happy with the final approach.
In summary, I am happy with the fact of being a MR jar and the entry of |
Emily-Jiang
left a comment
There was a problem hiding this comment.
LGTM! Thank you @rbygrave for your contribution!
|
Hi Scott @starksm64 , I am looking to find out what the next step is to get this PR merged (and ideally release 2.0.1 with a module-info to maven central). I see you have merged commits so perhaps you can help me / let me know what the next step is? Thanks, Rob. |
|
Hi @Cousjava I am trying to determine the next step to getting this PR merged. Are you able to help? Thanks, Rob. |
|
I'm a committer on this project and will merge this PR. |
|
FYI: Adding cross reference to issue #17 |
Removes Automatic-Module-Name manifest entry and replaces it with module-info via multi-version jar