Part 2. Adapting real-world projects

 

Part 1 of this book explored the module system’s basics and how to compile, package, and run modular applications. In addition to teaching the relevant mechanisms, it showed how future Java projects will be organized and developed.

But what about existing projects? I’m sure you’d like to see them running on Java 9 or later, maybe even as modules. This part covers how to make that happen.

The first step, getting a project to compile and run on Java 9+, is obligatory for any code base that doesn’t want to stay on Java 8 past its end of life or pay for support. The second step, turning the project’s artifacts into modular JARs, is optional and can be done over time.

Chapters 6 and 7 are dedicated to the migration to Java 9. They’re all about making your non-modular, class path-based project work on the newest release (without creating any modules). Chapter 8 then covers the features that allow you to incrementally modularize your project. Chapter 9 gives some strategic advice on how to migrate and modularize your project by using what you learned in chapters 6–8.

I recommend reading the chapters in that order, but if you prefer studying the technical details only when you need them, you could start with chapter 9. Alternatively, you could read up on the challenges you’ll most likely encounter first: dependencies on JEE modules (section 6.1) and on JDK internals (section 7.1).