[PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for...

78
PROJECT JIGSAW – INTEGRATION WITH TOOLS JavaOne 03.10.201 7 Alexandru Jecan Software Engineer | Author | SAN FRANCISCO

Transcript of [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for...

Page 1: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

PROJECT J IGSAW – INTEGRATION WITH

TOOLSJavaOne03.10.201

7 Alexandru JecanSoftware Engineer | Author | Trainer | Speaker | Consultant

SAN FRANCISCO

Page 2: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SUMMARY

02

1 Integration with Build Tools2 Apache Maven

7 Maven Jmod Plugin

PROJECT JIGSAW – INTEGRATION WITH TOOLS

3 Maven Compiler Plugin

5 Backward Compatibility Using Maven Toolchain Plugin Toolchain Plugin6 Maven JDeps Plugin

4 Maven Exec Plugin

Page 3: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SUMMARY

03

8 Maven Jlink Plugin9 Maven Dependency Plugin

12

PROJECT JIGSAW – INTEGRATION WITH TOOLS

1110

Ant

Gradle

Loom

Page 4: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SUMMARY

04

13 Moditect

PROJECT JIGSAW – INTEGRATION WITH TOOLS

GradleAnt

Loom

14 SonarJava

15 Graphviz

Page 5: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SUMMARY

05

16 Integration with Integrated Development Environments

17 NetBeans support

18 Eclipse support

19 Intellij IDEA support

PROJECT JIGSAW – INTEGRATION WITH TOOLS

21 JDK 9 Ready Libraries

22 Status Modularization Third-party Libraries

20 JDK 9 Ready Status

Page 6: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SUMMARY

06

23 Modularized Third-party Libraries24 How to Modularize a Library

29PROJECT JIGSAW – INTEGRATION WITH TOOLS

25 Encapsulated JDK internal APIs

26 Not resolved platform modules

2728

Cyclic dependenciesSplit packages

Java 9 Modularity Revealed book

Page 7: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

What do you expect from a tool to do in order to make development using Jigsaw easier?

QUESTION

07 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Page 8: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTEGRATION WITH BUILD TOOLS

08 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Jigsaw

Build Tools Strong encapsulation

Services Build the project Central repository

Link into run-time images Dependency management

The Java Module System, Nicolai Parlog, Manning

Reliable configuration Record dependencies Verify at compile time

and run time

Record artifacts Verify for compilation

Download artifacts

Select artifacts for compilation

Page 9: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTEGRATION WITH BUILD TOOLS

09 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Build Tools Class path

Build ToolsClass path

Module path

Prior to JDK 9

JDK 9+

Page 10: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Only Maven 3+ supports Java 9

APACHE MAVEN

10 PROJECT JIGSAW – INTEGRATION WITH TOOLS

No changes were performed in Maven Core in order to make Maven run on Java 9

Maven can also use the module path for compilation (besides the class path)

Normal modules as well as automatic modules can be defined as dependencies

The presence of module-info.java decides if Maven uses the module path or not

Page 11: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

The <groupId>, <artifactId> and <version> from pom.xml are not related to the name of the module from module-info.java

APACHE MAVEN

11 PROJECT JIGSAW – INTEGRATION WITH TOOLS

To add a dependency in pom.xml, the Maven specific names are used, as before

To require a module in module-info.java, the name of the module from the module

descriptors is used

Page 12: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Offers support for JPMS starting with version 3.6.0

MAVEN COMPILER PLUGIN

12 PROJECT JIGSAW – INTEGRATION WITH TOOLS

During the compile phase, when a module-info.java file is found, it automatically switches to the module path

source and target have to be minimum 6

Latest version = 3.7.0 (as of September 2017) Requires JDK 7+

Module-info is compiled as well

Page 13: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN COMPILER PLUGIN

13 PROJECT JIGSAW – INTEGRATION WITH TOOLS

<compilerArgs> <arg>--add-modules</arg> <arg>java.xml.bind</arg></compilerArgs>

Flags like --add-modules or --add-exports can be added directly in the pom.xml

<compilerArgs> <arg>--add-exports</arg> <arg>java.base/sun.net=myModule</arg></compilerArgs>

Page 14: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN COMPILER PLUGIN

14 PROJECT JIGSAW – INTEGRATION WITH TOOLS

<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <executions> <execution> <id>example</id> <goals> <goal>compile</goal> </goals> <configuration> <compilerArgs> <arg>--add-exports</arg>

<arg>java.base/sun.net=myModule</arg> <arg>--add-modules</arg> <arg>java.xml.bind</arg></compilerArgs>

</configuration> </execution> </executions></plugin>

Page 15: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN COMPILER PLUGIN

15 PROJECT JIGSAW – INTEGRATION WITH TOOLS

A new tag called <release>, which has greater precendence over the <source> and <target> tags

<release> corresponds to the option “maven.compiler.release” For providing backward compatibility:

1) Module-info should be compiled with --release 92) All the other sources compiled with --source < 9 and --target < 9

Page 16: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN EXEC PLUGIN

16 PROJECT JIGSAW – INTEGRATION WITH TOOLS

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>${JAVA_HOME}/bin/java</executable> <arguments> <argument>--module-path</argument> <modulepath/> <argument>--module</argument> <argument>{myMainClass}</argument> <argument>${myArgument}</argument> </arguments> </configuration></plugin>

Java 9 Modularity Sander Mak,Paul Bakker,O’Reilly

Page 17: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Solves JEP 247: Compile for Older Platform VersionsBACKWARD COMPATIBILITY WITH MAVEN TOOLCHAIN PLUGIN

17 PROJECT JIGSAW – INTEGRATION WITH TOOLS

With toolchains, we can specify the JDKs installed on our system A project can be built using a specific version of the JDK that is independent from the one Maven is running with

To use Toolchains:1) The maven-toolchain-plugin should be adjusted2) The toolchains.xml file should be adjusted

Page 18: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Toolchains required when we have the module-info.java file inside the sources and we want to compile it with an older version of Java

BACKWARD COMPATIBILITY WITH MAVEN TOOLCHAIN PLUGIN

18 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Page 19: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDeps can:

MAVEN JDEPS PLUGIN

19 PROJECT JIGSAW – INTEGRATION WITH TOOLS

discover all static dependencies of a library discover the usages of internal JDK APIs automatically generate a module descriptor for a JAR

file Maven JDeps Plugin has two goals: jdkinternals => checks if main classes depend on

JDK-internal classes test-internals => checks if test classes depend on

JDK-internal classes

Page 20: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

A compilation is necessary, since JDeps uses classes and not sources

MAVEN JDEPS PLUGIN

20 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Should be used to test if your project is ready for JDK 9 By setting the <failOnWarning> option to true, the build will immediately fail if there are any warnings

Page 21: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN JDEPS plugin

21 PROJECT JIGSAW – INTEGRATION WITH TOOLS

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jdeps-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>testOnClasses</id> <goals> <goal>jdkinternals</goal> <goal>test-jdkinternals</goal> </goals> </execution> <execution> <id>testOnDependencies</id> <goals> <goal>jdkinternals</goal> <goal>test-jdkinternals</goal> </goals> <configuration> <failOnWarning>false</failOnWarning> <recursive>true</recursive> </configuration> </execution> </executions></plugin>

Page 22: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Pre-release version (as of September 2017)

MAVEN JMOD PLUGIN

22 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Can create JMOD files (create goal)

First version = 3.0.0-alpha-1 Works with Maven 3+ and JDK 7+

Can list the content of a JMOD file (list or describe goal)

Page 23: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Pre-release version (as of September 2017)

MAVEN JLINK PLUGIN

23 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Can create Modular Run-Time Images via Jlink from jar /JMOD files (jlink goal)

First version = 3.0.0-alpha-1 Works with Maven 3+ and JDK 7+

Has parameters like: <addModules>, <bindServices>, <compression>, <limitModules>, etc.

Page 24: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MAVEN DEPENDENCY PLUGIN

24 PROJECT JIGSAW – INTEGRATION WITH TOOLS

The list option lists the groupId, artifactId together with the name of the module

Page 25: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Works since the --illegal-access=permit option was set as default

GRADLE

25 PROJECT JIGSAW – INTEGRATION WITH TOOLS

No --add-opens options necessary to build GradleNo first class support for Java 9 modules as of 26.09.2017

Work in progress

Running Java 9 on Gradle 4.1+ is supported Example of producing a multi-release JAR with Gradle => https://github.com/melix/mrjar-gradle

Page 26: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Ants java, javac and junit understand the new command-line parameters that are specific to JDK 9 modules

ANT

26 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Single module and multi module compilation supported Support for module path and upgrade module path added in Ant 1.9.7

Since Ant 1.9.8 and 1.10.0: <java>, <javac> and <junit> support JDK 9 modules Support for javac --release option ant.java.version holds the value “9”

Page 27: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

LOOM

27 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Modern and lightweight build tool for Java 9+ YAML configuration Convention over configuration Build with Java 9 => first-class JPMS support (Optional) Minimalistic configuration Dependency resolution (powered by the Apache Maven Repository) Support for Junit 5, Checkstyle, SpotBugs, PMD, IntellijIDEA, Eclipse

Page 28: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

LOOM

28 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://loom.builders/

Loom source code => https://github.com/loom-build-tool/loom

Loom documentation => https://loom-build-tool.readthedocs.io/en/latest/

Examples with Loom => https://github.com/loom-build-tool/loom-examples

Page 29: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

https://github.com/moditect/moditect

MODITECT

29 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Maven plugin Can generate module-info.java descriptors for given artifacts on behalf of the specific information written by developers in pom.xml Can add module descriptors to JAR files

Can create modular runtime images

Page 30: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Support for JPMS starting from version 4.11

SonarJAVA

30 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Able to recognize and parse module-info.java Can handle the directives from module-info.java: requires, exports, opens, uses and provides

ModuleDeclaration: {Annotation} [open] module Identifier {. Identifier} { {ModuleDirective} }

Recognizes new keywords related to modules from Java 9

Page 31: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Open source graph visualization softwareGRAPHVIZ

31 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Creates a graphical representation of Jigsaw modules and their dependencies:

jdeps -dotoutput jdeps-dotoutput modules/*.jar \Tools\Graphviz\release\bin\dot.exe –Tpngjdeps-dotoutput/summary.dot > graphviz-summary.png

start graphviz-summary.png

Example for Windows:

http://www.torsten-horn.de/techdocs/Jigsaw.html#Abh%C3%A4ngigkeitsgraph-mit-Graphviz

Page 32: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTEGRATION WITH INTEGRATED DEVELOPMENT ENVIRONMENTS

32 PROJECT JIGSAW – INTEGRATION WITH TOOLS

NetBeans Support

Intellij IDEA Support Eclipse Support

Page 33: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

33 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Support for JDK 9 starting from NetBeans 9

1) Build with Ant from: https://github.com/apache/incubator-netbeans

NetBeans 9 not yet officialy released (as of 26.09.2017)

JDK 8 is mandatory for building NetBeans 9; cannot use JDK 9 or JDK 7 or older

Two options:

2) Download the latest Development build from: https://builds.apache.org/job/incubator-netbeans-linux/

NetBeans 9 runs on top of JDK 8 as well as JDK 9

Page 34: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

34

One NetBeans project now supports multiple Jigsaw modules Support for Maven projects

New Project Type => Java Modular Project

https://cwiki.apache.org/confluence/display/NETBEANS/NetBeans+9.0+-+New+and+Noteworthy

Set netbeans_jdkhome in netbeans.conf to point

to JDK 9 installation

Page 35: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

35 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Support for adding module-info (New =>Other => Java => Java Module Info) => supports code completion

https://cwiki.apache.org/confluence/display/NETBEANS/NetBeans+9.0+-+New+and+Noteworthy

Page 36: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

36 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://cwiki.apache.org/confluence/display/NETBEANS/NetBeans+9.0+-+New+and+Noteworthy

Support for module path Edit – Compile – Debug cycle supported

Page 37: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

37 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Go to Tools => Java Platforms and verify that it is running on JDK 9

Project property can be set to JDK 9 Source/binary format for files can be set to JDK 9

Page 38: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

38 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Module Dependency Graph using the Graph View

http://wiki.netbeans.org/JDK9Support

Page 39: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

39 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Support for packaging project files into a custom run-time using Jlink

https://cwiki.apache.org/confluence/display/NETBEANS/NetBeans+9.0+-+New+and+Noteworthy

Page 40: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NETBEANS SUPPORT

40

JShell integration

https://cwiki.apache.org/confluence/display/NETBEANS/NetBeans+9.0+-+New+and+Noteworthy

Page 41: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

ECLIPSE SUPPORT

41 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Eclipse Oxygen with Java 9 support Oxygen.1 => 27.09.2017 Oxygen.2 => 20.12.2017 Oxygen.3 => 21.03.2018

https://wiki.eclipse.org/Photon/Simultaneous_Release_Plan#Schedule

For Java 9 support, you can also update other Eclipse IDE to Eclipse 4.7. More info => https://marketplace.eclipse.org/content/java-9-support-beta-oxygen

Page 42: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

ECLISE SUPPORT

42 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Add JRE and JDK 9 as installed JRE Support for JavaSE-9 execution environment Module compilation IDE can be launched with JDK 8 or JDK 9 Support for module path + class path

Page 43: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

43 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Support for Jigsaw modules starting from version 2017.1

Code completion in the module-info Each Jigsaw module has to correspond to an Intellij IDEA module

Enhancements in versions 2017.2 and 2017.3

For a module, “Mark directory as => Sources root”

Page 44: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

44 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Supports module path, class path, module path + class path

Page 45: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

45 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Page 46: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

46 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Page 47: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Intellij idea support

47 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Page 48: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

48 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Package not exported => “Package not found”

No readability defined in module-info

Page 49: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

49

Recognizes when a platform module is not required

Can suggest to add missing requires clauses in module-info

Page 50: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

50

Code completion for exporting packages

Code completion in module-info

Page 51: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

51 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Both Intellij IDEA module dependencies as well as Jigsaw module dependencies have to be declared

module com.javaone.application { requires com.javaone.service;}

Page 52: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

52 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Dependency Diagram for Java 9

Page 53: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

53 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Opens clause in open module not allowed

Duplicate clauses in module-info detected

https://blog.jetbrains.com/idea/2017/07/support-for-java-9-in-intellij-idea-2017-2/

Page 54: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

54 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Find usages

https://blog.jetbrains.com/idea/2017/07/support-for-java-9-in-intellij-idea-2017-2/

Page 55: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

55 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Inspection

Possibility to highlight the automatic modules, etc.

Page 56: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

INTELLIJ IDEA SUPPORT

56 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Support for Maven projects

Automatically runs with the module path instead of class path Quick fixes for adding items in the module-info.java file

Page 57: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDK 9 READY STATUS (AS OF 24.09.17)

57 PROJECT JIGSAW – INTEGRATION WITH TOOLS

23%

30%

47%

JDK 9 Ready Status for 98 third-party libraries

JDK 9 Ready librariesJDK 9 Ready soon librariesJDK 9 libraries not ready

https://wiki.openjdk.java.net/display/quality/Quality+Outreach

Page 58: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDK 9 READY LIBRARIES (AS OF 24.09.17)

58 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://wiki.openjdk.java.net/display/quality/Quality+Outreach

Library Name JDK 9 Ready

JDK 9 Ready starting from Version

Apache Derby Yes 10.13.1.1Apache Log4j Yes 2.9.0Apache Lucene / Solr Yes 7.0 (for both Lucene and Solr)Apache Maven Yes 3.0Apache PDFBox Yes 2.0.8Apache POI Yes 3.17bt YesCruiseControl YesGraphHopper Yes

Page 59: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDK 9 READY LIBRARIES (AS OF 24.09.17)

59 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://wiki.openjdk.java.net/display/quality/Quality+Outreach

Library Name JDK 9 ReadyHeapStats YesHibernate YesJackson YesJaCoCo YesJITWatch YesJOSM YesJunit 5 YesLWJGL YesRapidoid Yes

Page 60: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDK 9 READY LIBRARIES (AS OF 24.09.17)

60 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://wiki.openjdk.java.net/display/quality/Quality+Outreach

Library Name JDK 9 ReadyRedHat Wildfly YesRxJava YesSpotbugs YesWoodstox Yes

Page 61: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

JDK 9 READY SOON LIBRARIES (AS OF 24.09.17)

61 PROJECT JIGSAW – INTEGRATION WITH TOOLS

https://wiki.openjdk.java.net/display/quality/Quality+Outreach

Library Name

Library Name

Library Name

Library Name

Library Name

Apache JMeter DataCleaner Golo JLine Roaring

Apache MetaModel

Drools Groovy Jboss-Forge Spring Framework

Apache Tomcat EasyMock Hazelcast Kotlin ZXing

Apache Tika Eclipse Jetty HSQLDB Objenesis

Byteman Ehcache JavaEWAH OptaPlanner

Classworlds ElasticSearch JBoss Tools oVirt engine

Page 62: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

STATUS MODULARIZATION THIRD-PARTY LIBRARIES

62 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Modular-ized 2%

Not Modu-larized98%

Status modularization - 58 libraries

Modularized Not Modularized

Page 63: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

63 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

Accumulo NoActiveMQ NoAmbari NoAnt NoAurora NoAvro NoAxis NoCassandra NoCloudStack NoCordova NoCouchDB No

Page 64: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

64 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

EclipseLink NoFalcon NoFlex NoFlume NoGeronimo NoGrails NoGroovy NoGuava NoHadoop NoHbase NoHibernate No

Page 65: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

65 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

Jackrabbit NoJackson NoJDO NoJersey NoJetty NoJoda NoJsoup NoKafka NoKnox NoLog4j NoLombok No

Page 66: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

66 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

Lucene NoMahout NoMaven NoMesos NoMockito NoOozie NoOpenJPA NoPerl NoPig NoPowerMock NoQuarz No

Page 67: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

67 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

SLF4J YesSpark NoSpring NoStruts NoSubversion NoSWT NoTapestry NoTestNG NoTiles NoTomcat NoVaadin No

Page 68: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

MODULARIZED THIRD-PARTY LIBRARIES

68 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Library Name Modularized (as of 23.09.2017)

Velocity NoXerces NoZooKeeper No

Page 69: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

HOW TO MODULARIZE A LIBRARY

69 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Modularize the codebase by introducing a module-info.java file for each module A module-info.java file can be:

1) Created manually by the developers2) Automatically generated using the JDeps tool with the option --generate-module-info

The most common four issues that can occur during the modularization of a library are:

1) Encapsulated JDK internal APIs2) Not resolved modules

3) Cyclic dependencies4) Split packages

Page 70: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

ENCAPSULATED JDK INTERNAL APIS

70 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Most of the internal JDK APIs are inaccessible in Java 9 Trying to access them causes a compilation error

Internal APIs are in the sun.* package, but not onlyThe module jdk.unsupported is still accessible: sun.misc.Unsafe, sun.reflect.Reflection, sun.misc.Signal, sun.reflect.ReflectionFactory, sun.misc.SignalHandler

Page 71: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

ENCAPSULATED JDK INTERNAL APIS

71 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Breaking encapsulation of the JDK Internal APIs:

Page 72: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NOT RESOLVED PLATFORM MODULES

72 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Not all the platform modules from the JDK are available at compile-time

All the packages from module java.se.ee are not available at compile-time: java.xml.ws, java.xml.bind, java.corba, java.activation, java.xml.ws.annotations => package not exist error encountered at compile-time

Page 73: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

NOT RESOLVED PLATFORM MODULES

73 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Solution: add the module that contains the needed packages in the graph of modules using the --add-modules options

--add-modules java.xml.bind

Use --add-modules both at compile-time and at run-time

Page 74: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

CYCLIC DEPENDENCIES

74 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Forbidden at compile-time (between modules) JPMS does not allow cycles in the “requires” clauses JPMS allows cycles in the “reads” relation of run-time modules

module A { requires B;}

module B { requires A;}

Page 75: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

CYCLIC DEPENDENCIES

75 PROJECT JIGSAW – INTEGRATION WITH TOOLS

One solution is to merge the JARs into a single module Redesign might be necessary to a higher degree Cycles can be broken by using interfaces

Page 76: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

SPLIT PACKAGES

76 PROJECT JIGSAW – INTEGRATION WITH TOOLS

Modules that contain packages having the same name must not interfere with each other

Solutions for JAR files: Create a single JAR file out of the two JAR files Rename one of the package

Solutions for modules: Create a single module out of two or more modules Create a third module Remove the package dependencies

Page 77: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

Java 9 Modularity Revealed

Apress, 2017221 pagesISBN: 978 - 1484227121

Page 78: [PPT]PowerPoint Presentation - RainFocus | Harness … · Web viewOutreach JDK 9 Ready Status for 98 third-party libraries Verkauf JDK 9 Ready libraries JDK 9 Ready soon libraries

@alexandrujecan

alexandrujecan

[email protected]

alexandrujecan.com