We've learned about a couple of powerful ways in which we can tweak the default behavior of module dependencies in Java 9. Let's get hands-on now and apply some of these to our address book viewer application.
Notice that we have two modules in the address book viewer application that provides a view of the address book. The packt.addressbook
module shows a simple list of contacts in command line. The packt.addressbook.ui
module shows the address book contacts and details in UI form. Both these modules happen to use the two utility modules to get the list of contacts (packt.contact
) and to sort them (sort.util
). Here, we have just two modules, so it's not that big of a deal to add the requires descriptor for both of these modules in two places. But imagine if there were many more libraries and many more consumers! You'd be duplicating the list multiple times.
To avoid that, let's create an aggregator module that...