Stephen Colebourne scolebourne at joda.org
Wed Mar 15 17:09:11 UTC 2017

On 15 March 2017 at 14:34, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 15/03/2017 10:13, Stephen Colebourne wrote:
>> Automatic modules must either contain the
>> Module-Name MANIFEST entry, or have a file name that exactly matches
>> the desired module name. ie. the standard jar files downloaded from
>> Maven Central, eg foo-bar-1.2 must be renamed to be used as an
>> automatic module.
> This looks like it would force everyone starting out to rename lots of JAR
> files and essentially choose module names for libraries that they don't
> maintain. The module name is something that the module author should choose.
> Having the consumer or others trying to force a different name feels
> chaotic.

The proposal above only applies at runtime, not when authoring. Given a module:

module foo {
  requires bar;

Then the proposal says the requires clause can be satisfied in one of
three ways.
1) a real module on the module path named "bar"
2) a jar file on the module path of any filename with a "Module-Name:
3) a jar file on the module path with filename "bar.jar"

A developer or build system that downloads bar-1.2.jar from Maven
Central would have to rename it to put it on the module path.

Reading your response, I can only assume that you are thinknig of a
case where a developer simply moves from the classpath to the module
path for their whole application without writring any module-info
files. That seems like a daft use case to me - just stick with the
classpath. The use case that automatic modules are supposed to handle
is where your application or library is modularized, and depends
directly or indirectly on a jar file that has not yet been
modularized. In this use case, renaming the jar file to match the
module name is perfectly reasonable.

(Again noting that automatic modules in general are not a good
solution to the problem space in general)


More information about the jigsaw-dev mailing list