How many modules per jar?
Alex Buckley
alex.buckley at oracle.com
Mon Nov 28 19:42:08 UTC 2016
If you're writing new code, then packaging each module into its own JAR
file (a "modular JAR") is the right thing to do.
If you're modularizing old code that is already delivered as JAR files,
then you might have some difficulties. One difficulty is cyclic
dependencies between code in different JAR files. Another difficulty is
the same package being "split" over multiple JAR files. Modules don't
allow cyclic dependencies between themselves, nor split packages, and if
you can't declare the modules then you can't make any modular JARs. This
is covered in "Project Jigsaw: Under The Hood" at
http://openjdk.java.net/projects/jigsaw/talks/#j1-2016.
One good thing to look at in your lecture is the JDK module graph shown
in JEP 200 and summarized on the Project Jigsaw page.
Alex
On 11/27/2016 10:28 AM, Pisarev, Vitaliy wrote:
> I am not sure I hit the right mailing list, kindly redirect me if
> needed.
>
> I am preparing a lecture for my team about the new module system and
> wondering whether there is already a set of best practices around
> this.
>
> For example: should we host each module in a separate jar or should a
> jar contain more than one module if the list is cohesive enough?
>
> Thanks, Vitaliy.
>
More information about the jigsaw-dev
mailing list