GoSimpleLLC / nbvcxz

Password strength estimator
MIT License
292 stars 55 forks source link

Define a stable automatic module name #46

Closed eckig closed 4 years ago

eckig commented 5 years ago

nbvcxz does not currently use modules. When we use it in a JDK9 modular application, Java turns the JAR into a so-called automatic module, whose name is derived from the file name. However, the default name does not follow the recommended module naming conventions (reverse-dns style, module name derived from the main exported package).

It is possible to specify a stable automatic module name through a Automatic-Module-Name manifest entry, while still targeting JDK8:

Automatic-Module-Name: me.gosimple.nbvcxz

Selecting a stable module name is very important, because Java does not allow two modules to own the same package. So either provide the module name through the manifest file or event better: Provide a complete module declaration.

Tostino commented 4 years ago

Thank you for the feedback.

I added the automatic module name to the pom in commit: 2f7e1883c15e844193e79af5090070ffa3730d9b

I confirmed it is in the manifest.mf

I've not worked on any modularized projects yet, so a full module declaration would be great but I am not sure when I will have the time to learn how to do so. If you have any pointers or have worked on modularized projects before i'd love to hear.

eckig commented 4 years ago

Sorry for the late reply... Unfortunately, the automatic module name is not present in the JAR file I just retrieved from maven.

I you want to provide a module-info.java you can start with this one as a baseline:

module me.gosimple.nbvcxz
{

    exports me.gosimple.nbvcxz;
    exports me.gosimple.nbvcxz.scoring;
}

Basically you just list all the packages that third parties (like me) are allowed to access with exports and if you depend on other modules you list them with requires.

Tostino commented 4 years ago

Working on this now, will have a new release in probably a week. Edit: that is with the automatic module name, not the module info.

I haven't done a release since that commit which is why it wasn't working for you.

Tostino commented 4 years ago

And, still haven't done a release. Apologies, but it just hasn't been possible for me to focus on for more than a few min. This will be closed once the next release happens.

Tostino commented 4 years ago

Closed due to release 1.5.0

eckig commented 4 years ago

Works, thanks 👍

Tostino commented 4 years ago

@eckig Glad to hear it, sorry for the long delay in getting a release out.