Skip to content
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

Decide on Java 9 module name #202

Closed
remkop opened this issue Oct 10, 2017 · 0 comments
Closed

Decide on Java 9 module name #202

remkop opened this issue Oct 10, 2017 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Oct 10, 2017

TBD (separate question): modularize by adding manifest attribute "Automatic-Module-Name": "<module-name>" or by adding module-info.class? Note that picocli wants to stay binary compatible for Java 5 users. (It may be possible to compile the module-info.java file once manually with Java 9 and include it as a binary resource for automated builds going forward.)

Option 1: project-name-prefix convention

Keep current picocli package name, and use it (the "super-package") as the module name.

Drawbacks: does not match published Maven Central group id.

Advantages: package name matches module name. But unclear why this would be a good thing.

// module-info.java
module picocli {
    exports picocli;
    exports picocli.groovy;
}

Option 2: reverse DNS module, keep current package name

Module name does not match super package name.

Drawbacks: unclear. (In JDK 9 itself, module name and the packages they hold are only loosely related.)

Advantages: follows reverse-DNS naming and matches published Maven Central group id (avoiding potential global clashes).

module info.picocli {
    exports picocli;
    exports picocli.groovy;
}

Option 3: reverse DNS module, rename package to match module name

Rename package to match reverse-DNS module name.

Drawbacks: renaming the package breaks binary backwards compatibility for existing users. New package name is less aesthetically attractive.

Advantages: pretty much guaranteed to be unique, follows all of Remi Forax's and Stephen Colebourne's recommendations.

module info.picocli {
    exports info.picocli;
    exports info.picocli.groovy;
}

References:

  1. Mark Reinhold seems to have a preference for project-name-prefix convention
  2. Remi Forax's recommendation that existing module on Maven Central should use a name that starts with the Maven Central group id
  3. Stephen Colebourne's recommends that
    ** Module names must be reverse-DNS, just like package names
    ** The module name must be related to the package names
    ** Module names are strongly recommended to be the same as the name of the super-package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant