-
Notifications
You must be signed in to change notification settings - Fork 51
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 Automatic-Module-Name to JAR #85
Conversation
If the JAR for this repo is used in a project where the module system is active, Java treats any "plain JAR" without a module descriptor as an "automatic module" and allows it to be used by other modules in the application. For instance, a module in an application using JPMS can depend on this project like ``` module com.mattnworb.jpms { requires com.spotify.completablefutures; } ``` Defining an `Automatic-Module-Name` allows for explicitly controlling the name that modules use when loading your automatic module, rather JPMS guessing at the automatic module name for the JAR based on the JAR's filename. Alternatively we could add a `module-info.java` to this project to enable it to be loaded as a regular (not automatic) module but that would also require increasing the compiler target from 8 to 9. Closes #82
I was curious to learn more about JPMS so when I saw the related issue I thought it would be a good excuse to finally do that :) |
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Automatic-Module-Name>com.spotify.completablefutures</Automatic-Module-Name> |
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.
Knowing nothing about JPMS: The package name in use is com.spotify.futures
. Should they match?
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.
It seems like that is the convention but not required, but I figured we'd have a conflict if we ever did the same thing in https://github.com/spotify/futures-extra which has the same package name.
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.
Yes, in futures-extra we have this: https://github.com/spotify/futures-extra/blob/master/src/main/java/module-info.java#L17
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.
oh nice, I did not realize there was a proper module-info there already
If the JAR for this repo is used in a project where the module system is
active, Java treats any "plain JAR" without a module descriptor as an
"automatic module" and allows it to be used by other modules in the
application.
For instance, a module in an application using JPMS can depend on this
project like
Defining an
Automatic-Module-Name
allows for explicitly controllingthe name that modules use when loading your automatic module, rather
JPMS guessing at the automatic module name for the JAR based on the
JAR's filename.
Alternatively we could add a
module-info.java
to this project toenable it to be loaded as a regular (not automatic) module but that
would also require increasing the compiler target from 8 to 9.
Closes #82