Skip to content

Commit

Permalink
Rewrite guidelines to Java 15 (#6973)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Oct 9, 2020
1 parent 4b1b7b4 commit c225533
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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

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

Expand All @@ -16,13 +16,14 @@ 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 14
### Java Development Kit 15

A working Java \(Development Kit\) 14 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 14 \(e.g `javac 14`\). 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 \(Develoment Kit\) 15 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 15 \(e.g `javac 15`\). 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. We recommend to setup the full Liberica JDK including JavaFX. You can get it from [https://bell-sw.com/pages/downloads/?version=java-14&package=jdk-full](https://bell-sw.com/pages/downloads/?version=java-14&package=jdk-full). On Windows, you can execute `choco install libericajdkfull` \(requires [installation of chocolatey - a package manager for Windows](https://chocolatey.org/install)\).
[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. ~~We recommend to setup the full Liberica JDK including JavaFX. You can get it from [https://bell-sw.com/pages/downloads/?version=java-15&package=jdk-full](https://bell-sw.com/pages/downloads/?version=java-15&package=jdk-full). On Windows, you can execute `choco install libericajdkfull` \(requires [installation of chocolatey - a package manager for Windows](https://chocolatey.org/install)\).~~ (Liberica JDK 15 does not include the Java compiler properly any more)

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

### GitHub Account

Expand Down Expand Up @@ -54,9 +55,18 @@ It is strongly recommend that you have git installed.

### IDE

We suggest [IntelliJ IDEA](https://www.jetbrains.com/idea/) or [Eclipse \(for advanced users\)](https://eclipse.org/) \(`2020-03` or newer\).
We suggest [IntelliJ IDEA](https://www.jetbrains.com/idea/).
For advanced users, [Eclipse](https://eclipse.org/) \(`2020-09` or newer\) is also possible.

On Ubuntu Linux, you can follow the [documentation from the Ubuntu Community](https://help.ubuntu.com/community/EclipseIDE#Download_Eclipse) or the [step-by-step guideline from Krizna](https://www.krizna.com/ubuntu/install-eclipse-in-ubuntu-12-04/) to install Eclipse. Under Windows, download it from [www.eclipse.org](http://www.eclipse.org/downloads/) and run the installer.
#### IntelliJ

We recommend to install IntelliJ IDEA using [JetBrains Toolbox App](https://www.jetbrains.com/toolbox-app/), because IDE updates are automatically installed.

#### Ecipse

On Ubuntu Linux, you can follow the [documentation from the Ubuntu Community](https://help.ubuntu.com/community/EclipseIDE#Download_Eclipse) or the [step-by-step guideline from Krizna](https://www.krizna.com/ubuntu/install-eclipse-in-ubuntu-12-04/) to install Eclipse. On Windows, download it from [www.eclipse.org](http://www.eclipse.org/downloads/) and run the installer.

Eclipse JEE 2020-09 or newer is required. For Eclipse 2020-09 you need to install [Java 15 Support](https://marketplace.eclipse.org/content/java-15-support-eclipse-2020-09-417).

### Other Tooling

Expand Down Expand Up @@ -86,22 +96,23 @@ This section explains how you get the JabRef code onto your machine in a form al

These steps are very important. They allow you to focus on the content and ensure that the code formatting always goes well. Did you know that [IntelliJ allows for reformatting selected code](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html#reformat_code) if you press Ctrl+Alt+L?

### Setup for IntelliJ IDEA

We recommend to install IntelliJ IDEA using [JetBrains Toolbox App](https://www.jetbrains.com/toolbox-app/), because IDE updates are automatically installed.
### Configuration of IntelliJ IDEA

IntelliJ IDEA fully supports Gradle as a build tool, but also has an internal build system which is usually faster. For JabRef, Gradle is required to make a full build but once set up, IntelliJ IDEA's internal system can be used for sub-sequent builds.

To configure IntelliJ IDEA for developing JabRef, you should first ensure that you have enabled both bundled plugins _Gradle_ and _Gradle Extension_:

* 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 14 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 15 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 15 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 15.
![Project Settings](../.gitbook/assets/intellij-choose-jdk-adoptopenjdk-on-windows-project-settings.png)

Ensure you have a Java 14 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 14:
Navigate to **File \| Project Structure \| Project** and ensure that the projects' SDK is Java 15
![Use JDK 15 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 14
* Navigate to **File \| Settings \| Build, Execution, Deployment \| Build Tools \| Gradle** and select the Java 14 SDK as the Gradle JVM at the bottom.
Navigate to **File \| Settings \| Build, Execution, Deployment \| Build Tools \| Gradle** and select the "Project SDK" as the Gradle JVM at the bottom.

To prepare IntelliJ's build system two additional steps are required:

Expand Down Expand Up @@ -174,15 +185,24 @@ Contributions to JabRef's source code need to have a code formatting that is con
* Go to **File \| Settings \| Editor \| Code Style**
* Click on the settings wheel \(next to the scheme chooser\), then click "Import Scheme"
* Select the IntelliJ configuration file `config/IntelliJ Code Style.xml`
* Go to **File \| Settings \| Tools \| Checkstyle \| Configuration File** 1. Import the CheckStyle configuration file by clicking the \[+\] button 2. For the description provide "JabRef" 3. Click "Browse" and choose `config/checkstyle/checkstyle.xml` 4. Click "Next" and "Finish" 5. Activate the CheckStyle configuration file by ticking it in the list 6. Ensure that the [latest CheckStyle version](https://checkstyle.org/releasenotes.html) is selected \(8.36 or higher\). 8.36 is required for Java 14. 7. Set the "Scan Scope" to "Only Java sources \(including tests\) 8. Save settings by clicking "OK" 9. Your configuration should now look like this:

```text
Finally, ensure that the checkstyle configuration file is in place:

1. Go to **File \| Settings \| Tools \| Checkstyle \| Configuration File**
2. Import the CheckStyle configuration file by clicking the \[+\] button
3. For the description provide "JabRef"
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.36 is required for Java 15.
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:
![checkstyle settings](../.gitbook/assets/intellij-checkstyle-settings.png)
```

### Setup for Eclipse

Make sure your Eclipse installation us up to date, Eclipse JEE 2020-03 or newer is required. For Eclipse 2020-03 you need to install [jdk14 support](https://marketplace.eclipse.org/content/java-14-support-eclipse-2020-03-415)
Make sure your Eclipse installation us up to date.

1. Run `./gradlew run` to generate all resources and to check if JabRef runs.
* The JabRef GUI should finally appear.
Expand Down Expand Up @@ -234,7 +254,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 14 is installed is following error message:
An indication that `JAVA_HOME` is not correctly set or no JDK 15 is installed is following error message:

```text
compileJava FAILED
Expand All @@ -261,9 +281,9 @@ In rare cases you might encounter problems due to out-dated automatically genera
There might be problems with building if you have openjfx libraries in local maven repository, resulting in errors like this:

```text
> Could not find javafx-fxml-14-mac.jar (org.openjfx:javafx-fxml:14).
> Could not find javafx-fxml-15-mac.jar (org.openjfx:javafx-fxml:15).
Searched in the following locations:
file:<your local maven repository path>/repository/org/openjfx/javafx-fxml/14/javafx-fxml-14-mac.jar
file:<your local maven repository path>/repository/org/openjfx/javafx-fxml/15/javafx-fxml-15-mac.jar
```

As a workaround, you can remove all local openjfx artifacts by deleting the whole openjfx folder from specified location.

0 comments on commit c225533

Please sign in to comment.