Keeping up with Java made easy with Apache Maven ROBERT SCHOLTE @RFSCHOLTE / @ASFMAVENPROJECT
Moving Java Forward Faster (2017/09/06) Proposal Taking inspiration from the release models used by other platforms and by various operating-system distributions, I propose that after Java 9 we adopt a strict, time-based model with a new feature release every six months, update releases every quarter, and a long- term support release every three years. Source: https://mreinhold.org/blog/forward-faster#Proposal
Surprise? http://openjdk.java.net/projects/jigsaw/spec/minutes/2017-05-18
Feature driven schedule 20192006 2008 2010 2012 2014 2016 2018 Java 6 December 2006 Java 7 July 2011 Java 8 March 2014 Java 9 September 2017
Time driven schedule 20212018 2019 2020 2021 Java 10 March 2018 Java 11 September 2018 Java 12 March 2019 Java 13 September 2019 Java 14 March 2020 Java 15 September 2020 Java 16 March 2021
Is there really an issue? Let’s see…
3 6 6 6 7 JAVA 8 JAVA 9 JAVA 10 JAVA 11 JAVA 12 Java support Classes Sources
Maven runtime versus toolchains ❖ JAVA_HOME is used for the Maven runtime ❖ For ease, JAVA_HOME is the default JDK ❖ With Maven Toolchains some plugins can get an explicit JDK ❖ Most reliable setup: toolchain
#RunsFineOnJDK9 #WorksLikeHeavenOnJDK11 ❖ For Maven: YES! ❖ For the plugins: it depends… (most are fine!)
Sourcecode parser QDox: ❖ reads model up to method signatures ❖ is less critical due to close to no language changes at this level
Bytecode parser ASM: ❖ reads entire class, must know bytecode version ❖ is very critical, will now be updated every 6 months
20182014 2015 2016 2017 2018 Java 9-ea 8 Apr '14 Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Jigsaw ea 3 Nov '14 Releases of Java after 2014
Java 9 / Jigsaw early access ❖ Jigsaw team ❖ Java community ❖ Maven team
2018 Today 2014 2015 2016 2017 2018 Java 9-ea 8 Apr '14 Jigsaw ea 3 Nov '14 Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.6.0 26 Oct '16 Maven Compiler Plugin 3.6.1 13 Jan '17 Maven Compiler Plugin 3.6.2 26 Jul '17 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
Maven Compiler Plugin 3.5.1 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <compilerArgs> <arg>-verbose</arg> <arg>-Xlint:all,-options,-path</arg> </compilerArgs> </configuration> </plugin>
Maven Compiler Plugin 3.6.x First implementations of module path support for early adopters Requirements: ❖ No changes to the pom.xml ❖ (Close to) no extra configuration for developers Dependencies: ❖ ASM 6.0_ALPHA ❖ QDox 2.0-M6
Java 9 / Maven Compiler Plugin 3.7.0 Module Resolution moved to Plexus::Java Dependencies: ❖ ASM 6.0_BETA ❖ QDox 2.0-M7
Plexus::Java Maven independent library for general Java features ❖LocationManager ❖JavaVersion Used by ❖maven-compiler-plugin ❖maven-javadoc-plugin ❖maven-jlink-plugin ❖maven-jmod-plugin ❖maven-surefire-plugin / maven-failsafe-plugin ❖…
2018Sep Nov 2018 Mar May Jul Sep Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
Java 10 / Maven Compiler Plugin ??? https://stackoverflow.com/questions/49398894/unable-to-compile-simple-java- 10-java-11-project-with-maven Conclusion: no blocking issue
Updating ASM dependency This implies: updating to latest asm-6.x dependency is possible, but not to asm-7.x Updating plugin dependencies already possible since Maven 2 ClassReader reader = new ClassReader( in ); reader.accept( new ClassVisitor( Opcodes.ASM6 ) { … } );
2018Sep Nov 2018 Mar May Jul Sep Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
Java 11-ea / Maven Compiler Plugin 3.8.0 ❖Reduce need for ASM ❖Use java.lang.module.ModuleDescriptor#read(InputStream)
Will Maven run on future JDK releases? Yes, most likely Even Apache Maven 3.0 (released 4 oct 2010) runs on 12-ea Any issues are plugin related
Is it always forward compatible? Yes in case of modulepath resolution No for class analyzers (depend on ASM): ❖maven-dependency-plugin (analyze) ❖maven-plugin-plugin (descriptor) ❖maven-pmd-plugin (pmd) ❖maven-shade-plugin (minifyJar)
How do we test? https://builds.apache.org/job/maven-box/
Conclusion Java Release Train reveals critical chain of dependencies A few plugins might not work right after a new Java release Depending on the problem: ❖ Update related plugin dependency in your own project ❖ Patch plugin code (please create PR to help each other)
Questions?
Up-for-grabs ~60-80% of Java Project/Developers use Maven The Apache Maven Project holds ~100 (sub)projects Maintained by ~5-10 active volunteers (No Company!) Let’s restore the balance! https://s.apache.org/up-for-grabs_maven https://maven.apache.org/guides/development/guide-committer-school.html
20:00-21:00 BOF1 Apache Maven BOF Robert Scholte Karl Heinz Marbaise Hervé Boutemy
Thank you 20:00-21:00 BOF1 Apache Maven BOF Robert Scholte Karl Heinz Marbaise Hervé Boutemy

Keeping up with Java made easy with Apache Maven (Devoxx 2018)

  • 1.
    Keeping up withJava made easy with Apache Maven ROBERT SCHOLTE @RFSCHOLTE / @ASFMAVENPROJECT
  • 2.
    Moving Java ForwardFaster (2017/09/06) Proposal Taking inspiration from the release models used by other platforms and by various operating-system distributions, I propose that after Java 9 we adopt a strict, time-based model with a new feature release every six months, update releases every quarter, and a long- term support release every three years. Source: https://mreinhold.org/blog/forward-faster#Proposal
  • 3.
  • 4.
    Feature driven schedule 201920062008 2010 2012 2014 2016 2018 Java 6 December 2006 Java 7 July 2011 Java 8 March 2014 Java 9 September 2017
  • 5.
    Time driven schedule 202120182019 2020 2021 Java 10 March 2018 Java 11 September 2018 Java 12 March 2019 Java 13 September 2019 Java 14 March 2020 Java 15 September 2020 Java 16 March 2021
  • 6.
    Is there reallyan issue? Let’s see…
  • 7.
    3 6 6 6 7 JAVA 8 JAVA 9 JAVA10 JAVA 11 JAVA 12 Java support Classes Sources
  • 8.
    Maven runtime versustoolchains ❖ JAVA_HOME is used for the Maven runtime ❖ For ease, JAVA_HOME is the default JDK ❖ With Maven Toolchains some plugins can get an explicit JDK ❖ Most reliable setup: toolchain
  • 9.
    #RunsFineOnJDK9 #WorksLikeHeavenOnJDK11 ❖ For Maven:YES! ❖ For the plugins: it depends… (most are fine!)
  • 10.
    Sourcecode parser QDox: ❖ readsmodel up to method signatures ❖ is less critical due to close to no language changes at this level
  • 11.
    Bytecode parser ASM: ❖ readsentire class, must know bytecode version ❖ is very critical, will now be updated every 6 months
  • 12.
    20182014 2015 20162017 2018 Java 9-ea 8 Apr '14 Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Jigsaw ea 3 Nov '14 Releases of Java after 2014
  • 13.
    Java 9 /Jigsaw early access ❖ Jigsaw team ❖ Java community ❖ Maven team
  • 14.
    2018 Today 2014 2015 20162017 2018 Java 9-ea 8 Apr '14 Jigsaw ea 3 Nov '14 Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.6.0 26 Oct '16 Maven Compiler Plugin 3.6.1 13 Jan '17 Maven Compiler Plugin 3.6.2 26 Jul '17 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
  • 15.
    Maven Compiler Plugin3.5.1 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <compilerArgs> <arg>-verbose</arg> <arg>-Xlint:all,-options,-path</arg> </compilerArgs> </configuration> </plugin>
  • 16.
    Maven Compiler Plugin3.6.x First implementations of module path support for early adopters Requirements: ❖ No changes to the pom.xml ❖ (Close to) no extra configuration for developers Dependencies: ❖ ASM 6.0_ALPHA ❖ QDox 2.0-M6
  • 17.
    Java 9 /Maven Compiler Plugin 3.7.0 Module Resolution moved to Plexus::Java Dependencies: ❖ ASM 6.0_BETA ❖ QDox 2.0-M7
  • 18.
    Plexus::Java Maven independent libraryfor general Java features ❖LocationManager ❖JavaVersion Used by ❖maven-compiler-plugin ❖maven-javadoc-plugin ❖maven-jlink-plugin ❖maven-jmod-plugin ❖maven-surefire-plugin / maven-failsafe-plugin ❖…
  • 19.
    2018Sep Nov 2018Mar May Jul Sep Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
  • 20.
    Java 10 /Maven Compiler Plugin ??? https://stackoverflow.com/questions/49398894/unable-to-compile-simple-java- 10-java-11-project-with-maven Conclusion: no blocking issue
  • 21.
    Updating ASM dependency Thisimplies: updating to latest asm-6.x dependency is possible, but not to asm-7.x Updating plugin dependencies already possible since Maven 2 ClassReader reader = new ClassReader( in ); reader.accept( new ClassVisitor( Opcodes.ASM6 ) { … } );
  • 22.
    2018Sep Nov 2018Mar May Jul Sep Java 9 22 Sep '17 Java 10 20 Mar '18 Java 11 25 Sep '18 Maven Compiler Plugin 3.7.0 1 Sep '17 Maven Compiler Plugin 3.8.0 26 Jul '18 Releases of Maven Compiler Plugin
  • 23.
    Java 11-ea /Maven Compiler Plugin 3.8.0 ❖Reduce need for ASM ❖Use java.lang.module.ModuleDescriptor#read(InputStream)
  • 24.
    Will Maven runon future JDK releases? Yes, most likely Even Apache Maven 3.0 (released 4 oct 2010) runs on 12-ea Any issues are plugin related
  • 25.
    Is it alwaysforward compatible? Yes in case of modulepath resolution No for class analyzers (depend on ASM): ❖maven-dependency-plugin (analyze) ❖maven-plugin-plugin (descriptor) ❖maven-pmd-plugin (pmd) ❖maven-shade-plugin (minifyJar)
  • 26.
    How do wetest? https://builds.apache.org/job/maven-box/
  • 27.
    Conclusion Java Release Trainreveals critical chain of dependencies A few plugins might not work right after a new Java release Depending on the problem: ❖ Update related plugin dependency in your own project ❖ Patch plugin code (please create PR to help each other)
  • 28.
  • 29.
    Up-for-grabs ~60-80% of JavaProject/Developers use Maven The Apache Maven Project holds ~100 (sub)projects Maintained by ~5-10 active volunteers (No Company!) Let’s restore the balance! https://s.apache.org/up-for-grabs_maven https://maven.apache.org/guides/development/guide-committer-school.html
  • 30.
    20:00-21:00 BOF1 Apache MavenBOF Robert Scholte Karl Heinz Marbaise Hervé Boutemy
  • 31.
    Thank you 20:00-21:00 BOF1 ApacheMaven BOF Robert Scholte Karl Heinz Marbaise Hervé Boutemy