From 889a105171958f3436bc7d13a5c89810800c75f4 Mon Sep 17 00:00:00 2001 From: Zhi Yuan Yong Date: Thu, 1 Mar 2018 13:48:10 +0800 Subject: [PATCH] build.gradle: upgrade to use Java 9 The project currently runs on Java 8. We should ensure compatibility with the latest public version as soon as it is out. Let's upgrade the project to run on Java 9 and update the documentation accordingly. Some of the properties in gradle.properties are no longer supported. As PermGen has been replaced with Metaspace, -XX:MaxPermSize=size has ceased support [1] and has been replaced with -XX:MaxMetaspaceSize [2]. Also, -XX:CMSPermGenSweepingEnabled has been superseded by -XX:+CMSClassUnloadingEnabled and removed in JDK 9 [3][4]. -XX:+CMSClassUnloadingEnabled however, is useless now. When PermGen was used previously, this command line argument ensured that PermGen was garbage collected [5]. However, Metaspace is automatically garbage collected [6], therefore there's no replacement for this argument. Let's remove or update these properties accordingly. Travis & AppVeyor are building the project using JDK 8. Since we are now running on Java 9, let's update them to build the project using JDK 9. To run tests using TestFX on Java 9, we have to update the dependencies in build.gradle. Let's update it according to TestFX's documentation [7]. Java 9 introduces a module system, causing internal packages such as javax.* and com.sun.* packages to be inaccessible. As our project uses these packages, our code is no longer compilable. Let's update build.gradle to import these modules. [1]: https://docs.oracle.com/javase/9/migrate/toc.htm [2]: http://java-latte.blogspot.sg/2014/03/metaspace-in-java-8.html [3]: http://www.oracle.com/technetwork/java/javase/9-removed-features-3745614.html [4]: https://stackoverflow.com/questions/3717937/cmspermgensweepingenabled-vs-cmsclassunloadingenabled [5]: https://stackoverflow.com/questions/3334911/what-does-jvm-flag-cmsclassunloadingenabled-actually-do [6]: http://kkgulati.blogspot.sg/2014/09/java-8-memory-model-metaspace.html [7]: https://github.com/TestFX/TestFX#java-9 --- .travis.yml | 4 ++-- appveyor.yml | 2 +- build.gradle | 20 ++++++++++++++------ docs/DeveloperGuide.adoc | 10 ++-------- docs/UserGuide.adoc | 7 +------ gradle.properties | 2 +- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d6f37d8ba8b..1ffe1f2a5c77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java matrix: include: - - jdk: oraclejdk8 + - jdk: oraclejdk9 script: >- ./config/travis/run-checks.sh && @@ -17,7 +17,7 @@ deploy: addons: apt: packages: - - oracle-java8-installer + - oracle-java9-installer before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock diff --git a/appveyor.yml b/appveyor.yml index 4660f313ab8b..03b94b033ffd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ test_script: - appveyor-retry gradlew.bat --no-daemon headless allTests environment: - JAVA_HOME: C:\Program Files\Java\jdk1.8.0 # Use 64-bit Java + JAVA_HOME: C:\Program Files\Java\jdk9 # Use 64-bit Java # Files/folders to preserve between builds to speed them up cache: diff --git a/build.gradle b/build.gradle index 5bf81339b1be..712d911901ab 100644 --- a/build.gradle +++ b/build.gradle @@ -18,8 +18,8 @@ plugins { // Specifies the entry point of the application mainClassName = 'seedu.address.MainApp' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_1_9 +targetCompatibility = JavaVersion.VERSION_1_9 repositories { mavenCentral() @@ -39,21 +39,29 @@ jacocoTestReport { } dependencies { - String testFxVersion = '4.0.7-alpha' + String testFxVersion = '4.0.12-alpha' compile group: 'org.fxmisc.easybind', name: 'easybind', version: '1.0.3' compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0' compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4' compile group: 'com.google.guava', name: 'guava', version: '19.0' + compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.8' + compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0' + compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0' + compile group: 'javax.activation', name: 'activation', version: '1.1.1' testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion + testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion, { + exclude group: 'org.testfx', module: 'testfx-internal-java8' + } testCompile group: 'org.testfx', name: 'testfx-junit', version: testFxVersion - testCompile group: 'org.testfx', name: 'testfx-legacy', version: testFxVersion, { + testCompile group: 'org.testfx', name: 'testfx-legacy', version: '4.0.8-alpha', { exclude group: 'junit', module: 'junit' } - testCompile group: 'org.testfx', name: 'openjfx-monocle', version: '1.8.0_20' + + testRuntime group: 'org.testfx', name: 'testfx-internal-java9', version: testFxVersion + testRuntime group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181' } shadowJar { diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc index 1733af113b29..6bf7b6bd7b57 100644 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -18,13 +18,7 @@ By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT` === Prerequisites -. *JDK `1.8.0_60`* or later -+ -[NOTE] -Having any Java 8 version is not enough. + -This app will not work with earlier versions of Java 8. -+ - +. *JDK `9`* or later . *IntelliJ* IDE + [NOTE] @@ -849,7 +843,7 @@ _{More to be added}_ [appendix] == Non Functional Requirements -. Should work on any <> as long as it has Java `1.8.0_60` or higher installed. +. Should work on any <> as long as it has Java `9` or higher installed. . Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage. . A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse. diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 74248917e438..91458ff89cab 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -21,12 +21,7 @@ AddressBook Level 4 (AB4) is for those who *prefer to use a desktop app for mana == Quick Start -. Ensure you have Java version `1.8.0_60` or later installed in your Computer. -+ -[NOTE] -Having any Java 8 version is not enough. + -This app will not work with earlier versions of Java 8. -+ +. Ensure you have Java version `9` or later installed in your Computer. . Download the latest `addressbook.jar` link:{repoURL}/releases[here]. . Copy the file to the folder you want to use as the home folder for your Address Book. . Double-click the file to start the app. The GUI should appear in a few seconds. diff --git a/gradle.properties b/gradle.properties index 728342109ca9..a2c5adffee4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.parallel=false -org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8 +org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8