-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add module-info #761
Add module-info #761
Conversation
@bowbahdoe Thanks for taking the initiative. Will leave this PR up for some days to see if it draws any comments or concerns. |
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.json</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin> It's a better configuration since it utilizes the standard Maven plugin. |
Hey @javadev - That does not solve the issue here. Adding an automatic module name (which is already done) just gives a stable name that isn't dependent on the jar name. It does not allow for usage of jlink or jpackage. If it is a concern using the moditect plugin, there is an alternate implementation where we include the source of the module-info and configure the compiler plugin to do a second compile. (we would add a Personally I found this easier, but the other way is an option. It would mean that folks would have to use Java 9+ to compile, |
I believe using the module info and Java 9+ compiler is a good idea. We should establish Java 9+ as the minimum required version first. |
John Jaylward has been granted approval for the pull request, and it is now ready for merging. |
I don't have write access |
Is some Gradle work still needed for this PR? |
No, the pipelines all use maven, and the deployment is maven based too. I believe gradle changes would only be needed if you wanted to support it from a standalone build |
I just tried building a clean pull of master using gradle on Windows 10, and the java compiler gave me a stack overflow. The maven build on the same system worked fine. I'm guessing we should just remove the gradle build as it seems to not be working and no one has noticed.
|
@johnjaylward I am able to do a clean build using Java 8 on a mac pro. Please let me know if you get any insights into why the build has an error in your environment. |
What problem does this code solve? Risks Changes to the API? Will this require a new release? Should the documentation be updated? Does it break the unit tests? Was any code refactored in this commit? Review status Starting 3-day comment window |
Looks like I initially tested the gradle build against JVM 17. When I explicitly switched to both JVM 1.8 and JVM 11, both of those build fine under gradle. |
So is this not going to lead to a maven central release? |
"require new release" is usually only "yes" for security issues, or major bug fixes. I'm not sure this counts as major. When a new release happens, this change will be in maven central, but this merge itself is not forcing a release. |
Gotcha - yep that makes sense. This definitely does not count as major |
Reverted during Release 20231013 since it broke deployment to the Maven repo. |
@stleary this doesn't seem like a good reason to revert this. The release should be updated to work. |
There is a Wiki page How to make a new JSON-Java release with clear and detailed instructions on how to perform a release. PRs that include changes to pom.xml will need to demonstrate that it does not affect the release instructions, or provide the necessary workaround. I think this is a fair approach that allows for changes but protects the functioning of the project. |
@stleary what errors were there? Can you open an issue with reference to this PR and what failed so someone can correct the problem. Supporting java9+ makes this PR required and just revering it without offering any additional information or a fix does seem right. |
This reverts commit b180dbe.
This reverts commit b180dbe.
This adds a module info for the reasons described in #760.
For users of Java 6, 7, or 8 this should not make any difference. The
module-info.class
should be inert underMETA-INF/versions/9/module-info.class
.The way I implemented it here was with moditect, which directly generates the module-info. There are pros and cons to this, but a small pro is that people should be able to at least run package with JDK 8