Skip to content

Commit

Permalink
Upgrade to jdk 17 (JabRef#8433)
Browse files Browse the repository at this point in the history
* Upgrade to jdk 17, cleaned up gradle.build

* Bump version

* Restore jacocoPrepare

* whitespace

* switched from adopt jdk to temurin jdk

* update gradle wrapper

* readd binary checksum

Co-authored-by: Siedlerchr <[email protected]>
  • Loading branch information
calixtus and Siedlerchr authored Jan 31, 2022
1 parent 395abea commit a8a6129
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Setup OSX key chain on OSX
if: matrix.os == 'macos-latest'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/refresh-journal-lists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Update journal lists
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-fetchers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run fetcher tests
run: ./gradlew fetcherTest
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run check style reporter
uses: nikitasavinov/checkstyle-action@master
Expand All @@ -54,8 +54,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run tests
run: xvfb-run --auto-servernum ./gradlew check -x checkstyleJmh -x checkstyleMain -x checkstyleTest
Expand Down Expand Up @@ -86,8 +86,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run tests on PostgreSQL
run: ./gradlew databaseTest --rerun-tasks
Expand Down Expand Up @@ -120,8 +120,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Run GUI tests
run: xvfb-run --auto-servernum ./gradlew guiTest
Expand Down Expand Up @@ -158,8 +158,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Update test coverage metrics
if: ${{ steps.checksecrets.outputs.secretspresent }}
Expand Down
31 changes: 13 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ group = "org.jabref"
version = project.findProperty('projVersion') ?: '100.0.0'

java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

// Workaround needed for Eclipse, probably because of https://github.com/gradle/gradle/issues/16922
// Should be removed as soon as Gradle 7.0.1 is released ( https://github.com/gradle/gradle/issues/16922#issuecomment-828217060 )
Expand Down Expand Up @@ -344,7 +344,7 @@ compileJava {
options.compilerArgs << "-Xlint:none"
dependsOn "generateSource"

options.annotationProcessorGeneratedSourcesDirectory = file("src-gen/main/java")
options.generatedSourceOutputDirectory.set(file("src-gen/main/java"))

moduleOptions {
// TODO: Remove access to internal api
Expand Down Expand Up @@ -472,37 +472,32 @@ task copyTestResources(type: Copy) {
processTestResources.dependsOn copyTestResources

tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
reports.html.outputLocation.set(file("${reporting.baseDir}/${name}"))
}

task jacocoMergePrep() {
task jacocoPrepare() {
doFirst {
// Ignore failures of tests
tasks.withType(Test) {
ignoreFailures = true
}
}
}
test.mustRunAfter jacocoMergePrep
databaseTest.mustRunAfter jacocoMergePrep
fetcherTest.mustRunAfter jacocoMergePrep
test.mustRunAfter jacocoPrepare
databaseTest.mustRunAfter jacocoPrepare
fetcherTest.mustRunAfter jacocoPrepare

task jacocoMerge(type: JacocoMerge) {
jacocoTestReport {
executionData files(
"$buildDir/jacoco/test.exec",
"$buildDir/jacoco/databaseTest.exec",
"$buildDir/jacoco/fetcherTest.exec").filter { it.exists() }
dependsOn jacocoMergePrep, test, databaseTest, fetcherTest
}

jacocoTestReport {
executionData jacocoMerge.destinationFile
dependsOn jacocoMerge
dependsOn jacocoPrepare, test, databaseTest, fetcherTest

reports {
csv.enabled = true
html.enabled = true
xml.enabled = true // coveralls plugin depends on xml format report
csv.getRequired().set(true)
html.getRequired().set(true)
xml.getRequired().set(true) // coveralls plugin depends on xml format report
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-into-the-code/development-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ JabRef 3.x is the effort to try to fix a lot of these issues. Much has been achi

We currently use two approaches: a) rewrite and put under test to improve quality and fix bugs, b) increase code quality. This leads to pull requests being reviewed by two JabRef developers to ensure i) code quality, ii) fit within the JabRef architecture, iii) high test coverage.

Code quality includes using latest Java8 features, but also readability.
Code quality includes using latest Java features, but also readability.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This guide explains how to set up your environment for development of JabRef. It

```
The most important step is to configure your IDE.
In case you know how to install JDK 16 with JavaFX support and to fork JabRef's code,
In case you know how to install JDK 17 with JavaFX support and to fork JabRef's code,
please scroll down to the IDE setup.
```

Expand All @@ -16,13 +16,13 @@ For a complete step-by-step guide for Linux using IntelliJ IDEA as the IDE, have

This section list the prerequisites you need to get started to develop JabRef. After this section, you are ready to get the code.

### Java Development Kit 16
### Java Development Kit 17

A working Java (Development Kit) 16 installation with Java FX support is required. In the command line (terminal in Linux, cmd in Windows) run `javac -version` and make sure that the reported version is Java 16 (e.g., `javac 16`). If `javac` is not found or a wrong version is reported, check your `PATH` environment variable, your `JAVA_HOME` environment variable or install the most recent JDK.
A working Java (Development Kit) 17 installation with Java FX support is required. In the command line (terminal in Linux, cmd in Windows) run `javac -version` and make sure that the reported version is Java 17 (e.g., `javac 17`). If `javac` is not found or a wrong version is reported, check your `PATH` environment variable, your `JAVA_HOME` environment variable or install the most recent JDK.

[JavaFX is not part of the default JDK any more](https://www.reddit.com/r/java/comments/82qm9x/javafx_will_be_removed_from_the_java_jdk_in_jdk\_11/), it needs to be installed separately if not using a special JDK.

Download and install the JDK from [https://jdk.java.net/](https://jdk.java.net). Afterwards, download the "jmods" JavaFX 16 zip archive from [https://gluonhq.com/products/javafx/](https://gluonhq.com/products/javafx/) and put the `.jmod` files into `C:\Program Files\OpenJDK\jdk-16\jmods`.
Download and install the JDK from [https://jdk.java.net/](https://jdk.java.net). Afterwards, download the "jmods" JavaFX 17 zip archive from [https://gluonhq.com/products/javafx/](https://gluonhq.com/products/javafx/) and put the `.jmod` files into `C:\Program Files\OpenJDK\jdk-17\jmods`.

### GitHub Account

Expand Down Expand Up @@ -102,11 +102,11 @@ To configure IntelliJ IDEA for developing JabRef, you should first ensure that y

* Navigate to **File | Settings | Plugins | Installed** and check that you have the _Gradle_ and _Gradle Extension_ enabled.

After that, you can open `jabref/build.gradle` as a project. It is crucial that Java 16 is used consistently for the JabRef project which includes ensuring the right settings for your project structure, Gradle build, and run configurations.
After that, you can open `jabref/build.gradle` as a project. It is crucial that Java 17 is used consistently for the JabRef project which includes ensuring the right settings for your project structure, Gradle build, and run configurations.

Ensure you have a Java 16 SDK configured by navigating to **File | Project Structure | Platform Settings | SDKs**. If you don't have one, add a new Java JDK and point it to the location of a JDK 16. ![Project Settings](../.gitbook/assets/intellij-choose-jdk-adoptopenjdk-on-windows-project-settings.png)
Ensure you have a Java 17 SDK configured by navigating to **File | Project Structure | Platform Settings | SDKs**. If you don't have one, add a new Java JDK and point it to the location of a JDK 17. ![Project Settings](../.gitbook/assets/intellij-choose-jdk-adoptopenjdk-on-windows-project-settings.png)

Navigate to **File | Project Structure | Project** and ensure that the projects' SDK is Java 16 ![Use JDK 16 as project SDK](../.gitbook/assets/intellij-choose-jdk15-project-default.png)
Navigate to **File | Project Structure | Project** and ensure that the projects' SDK is Java 17 ![Use JDK 17 as project SDK](../.gitbook/assets/intellij-choose-jdk15-project-default.png)

Navigate to **File | Settings | Build, Execution, Deployment | Build Tools | Gradle** and select the "Project SDK" as the Gradle JVM at the bottom.

Expand Down Expand Up @@ -211,7 +211,7 @@ Finally, ensure that the checkstyle configuration file is in place:
4. Click "Browse" and choose `config/checkstyle/checkstyle.xml`
5. Click "Next" and "Finish"
6. Activate the CheckStyle configuration file by ticking it in the list
7. Ensure that the [latest CheckStyle version](https://checkstyle.org/releasenotes.html) is selected (8.36 or higher). 8.43 is required for Java 16.
7. Ensure that the [latest CheckStyle version](https://checkstyle.org/releasenotes.html) is selected (8.36 or higher). 9.21 is required for Java 17.
8. Set the "Scan Scope" to "Only Java sources (including tests)
9. Save settings by clicking "OK"
10. Your configuration should now look like this:
Expand Down Expand Up @@ -295,7 +295,7 @@ Got it running? GREAT! You are ready to lurk the code and contribute to JabRef.
### Java installation
An indication that `JAVA_HOME` is not correctly set or no JDK 16 is installed is following error message:
An indication that `JAVA_HOME` is not correctly set or no JDK 17 is installed is following error message:
```
compileJava FAILED
Expand Down Expand Up @@ -346,9 +346,9 @@ This can include different modules.
There might be problems with building if you have openjfx libraries in local maven repository, resulting in errors like this:
```
> Could not find javafx-fxml-16-mac.jar (org.openjfx:javafx-fxml:16).
> Could not find javafx-fxml-17-mac.jar (org.openjfx:javafx-fxml:17).
Searched in the following locations:
file:<your local maven repository path>/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16-mac.jar
file:<your local maven repository path>/repository/org/openjfx/javafx-fxml/17/javafx-fxml-17-mac.jar
```
As a workaround, you can remove all local openjfx artifacts by deleting the whole openjfx folder from specified location.
Expand Down

0 comments on commit a8a6129

Please sign in to comment.