Converting plain JARs to Java modules

Glyn Normington gnormington at vmware.com
Mon Nov 7 03:15:04 PST 2011


On 7 Nov 2011, at 10:22, Alan Bateman wrote:

> On 07/11/2011 09:47, Glyn Normington wrote:
>> Thanks for those responses. I see that semi-automatic conversion of a existing JAR file to a modular JAR file is possible.
>> 
>> In case it's not obvious, please note that support for package level dependencies would permit a fully automatic conversion because it would then not be necessary to know the module name corresponding to each package dependency. A fully automatic converstion could be particularly useful in automatically serving up modularised versions of existing JARs, e.g. in a front end to Maven central.
> At least for Maven artifacts then you can generate a module name from the maven coordinates. In the current prototype then it uses artifactId at version when installing a Maven artifact as a module. It could be argued that the groupId should be in there too but exact mapping TBD. In any case, you don't know what the exported types are.

Good point about using the maven coordinates to infer module names. I wonder if dependencies expressed in Maven are sufficient to generate a module's dependencies? Sounds plausible.
 
As for exported types, a reasonable starting point is to export all the types of an existing JAR.

> 
> As regards static analysis then it will clearly be useful as a migration aid but it wouldn't catch everything. Mandy pointed out the class analyzer that we currently use in the build and there is clearly potential to do more.
> 
> -Alan.

Regards,
Glyn


More information about the jigsaw-dev mailing list