CORINTHIA ¡HOTEL BUDAPEST, ¡HUNGARY – OCTOBER ¡1-‑2, ¡2015 ¡–
Java is evolving rapidly:
Maven helps you staying on track
Hervé Boutemy - @hboutemy Arnaud Héritier - @aheritier
Java is evolving rapidly: Maven helps you staying on track Herv - - PowerPoint PPT Presentation
Java is evolving rapidly: Maven helps you staying on track Herv Boutemy - @hboutemy Arnaud Hritier - @aheritier CORINTHIA HOTEL BUDAPEST, HUNGARY OCTOBER 1-2, 2015 Goal With Apache Maven, learn how to
CORINTHIA ¡HOTEL BUDAPEST, ¡HUNGARY – OCTOBER ¡1-‑2, ¡2015 ¡–
Hervé Boutemy - @hboutemy Arnaud Héritier - @aheritier
– Java duke and maven owl cocktail
– Bytecode soup with its enforcer zest
– A piece of Animal Sniffer and its accompaniments
– The toolchain and its diligence of JDKs
Doxia,
http://git.io/jEFs Support ¡Engineer
Juggle with different Java versions (JDKs, JREs) To be able to use new features from recent tools And ensure compatibility against production target Java is 20 years old
Version First ¡publication JDK ¡Alpha ¡and ¡Beta 1995 JDK ¡1.0 January, ¡1996 JDK ¡1.1 February, ¡1997 J2SE ¡1.2 ¡(playground) December, ¡1998 J2SE ¡1.3 ¡(kestrel) May, ¡2000 J2SE ¡1.4 ¡(merlin) February, ¡2002 J2SE ¡5.0 ¡(tiger) September, ¡ 2004 Java ¡SE ¡6 ¡(mustang) December, ¡2006 Java ¡SE ¡7 ¡(dolphin) July, ¡2011 Java ¡SE ¡8 March, ¡2014 Java ¡SE ¡9 Early ¡2016
6 7 8
requiring recent JDK
environment: often quite old JRE (and the same on whole landscape?)
– Conservatory: JDK = min( JRE<every apps> ) + old associated tools… – Courageous: for each app, switch JDK & associated tools – Player (unaware?): recent JDK – Serious: recent JDK + CI and deep tests, with good coverage – Smart: Maven + a few configurations
Sources : http://www.oracle.com/technetwork/java/eol-‑135779.html http://www.ibm.com/developerworks/java/jdk/lifecycle/ http://maven.apache.org/docs/history.html
Java ¡8 ¡ ¡ ¡ ¡= ¡52 ¡(0x34) Java ¡7 ¡ ¡ ¡ ¡= ¡51 ¡(0x33) Java ¡6 ¡ ¡ ¡ ¡= ¡50 ¡(0x32) Java ¡5 ¡ ¡ ¡ ¡= ¡49 ¡(0x31) Java ¡1.4 ¡= ¡48 ¡(0x30) Java ¡1.3 ¡= ¡47 ¡(0x2F) Java ¡1.2 ¡= ¡46 ¡(0x2E) Java ¡1.1 ¡= ¡45 ¡(0x2D)
Even ¡if ¡its ¡main ¡known ¡usage ¡is ¡to ¡verify ¡ the ¡compatibility ¡with ¡JDK ¡APIs, ¡Animal ¡ Sniffer ¡is ¡genericand ¡can ¡be ¡used ¡to ¡ verify ¡any ¡API ¡after ¡having ¡generated ¡its ¡ signatures.
Example – Using a JDK 8 to compile your code must use only APIs from Java 7 How? – Provided as 3 tools : a Maven plugin, an enforcer rule, an Ant task. – Must be executed on compiled classes. Limitation – Can verify only APIs signatures. – Doesn’t cover semantic
– Detects the issue but doesn’t allow to fix it.
Must ¡swap ¡constraints: ¡application ¡over ¡build
JRE used by Maven & plugins JRE to execute the application JDK used in build tasks (javac…)
– You can use a recent JRE for Maven and its plugins – For each application, Maven uses the JDK version required by your project
Allows ¡to ¡easily ¡jungle ¡between ¡various ¡JDKs ¡to ¡ensure ¡there ¡is ¡no ¡ risk ¡for ¡the ¡targeted ¡application
6 7 8
JRE used by Maven & plugins JRE to execute the application JDK used in build tasks (javac…)
1. Available tools are configured (path….) in the file ~/.m2/toolchains.xml
plugin to select the required tool with possibly some constraints (version,…) 3. “toolchain aware” plugins will automatically use the selected tool
– m-compiler-p, m-javadoc-p, m-surefire-p, m-webstart-p, m-jarsigner-p, exec-maven-plugin, keytool-maven-plugin, …
– protobuf, netbeans, …
backward incompatibility