Step 2: Set up the build system: JDK and Gradle

Ensure that the project is synchronized

Press the synchronization button in the gradle menu.

  1. Locate the gradle icon on the right side and click on it.
  2. Click on the arrows on the left side of this pane.
Platform Settings - SDKs
Gradle sync button

Press Alt+1 to show the project view

Then, on the left side the project folder is there:

Project folder
Project folder

Switch JDK to the latest one

Go to “File > Project Structure” or press Ctrl+Shift+Alt+S.

Open Project Structure
Open Project Structure

Click on “Project” on the left side. Then, select temurin-24 as the project SDK (continue reading if this option is not available).

Project Structure - Project SDK
Project Structure - Project SDK

If you do not have the access to this JDK, download it by clicking on “Download JDK…” In the dialog that opens, select version 24, vendor “Eclipse Temurin (AdoptOpenJDK HotSpot)”, and click “Download”.

Dropdown to select Download JDK
Dropdown to select Download JDK
Download JDK dialog
Download JDK dialog

Finally enable the JDK:

  1. Click “OK” to close the dialog “Project Structure”.
  2. Wait for IntelliJ to index the new JDK.
  3. If IntelliJ crashes, restart it. At “Help > Memory Settings”, increase the “Maximum Heap Size”.

Enable annotation processors

Enable annotation processors by navigating to File > Settings > Build, Execution, Deployment > Compiler > Annotation processors and check “Enable annotation processing”

Enable annotation processing
Enabled annotation processing

Using Gradle from within IntelliJ IDEA

Ensuring JabRef builds with Gradle should always be the first step since this is the commonly supported way to build JabRef.

Use the Gradle Tool Window to build all parts of JabRef and run it. To do so, expand the JabRef project in the Gradle Tool Window, navigate to “jabgui”, expand it, navigate to “application”, expand it, and double click “run”.

JabRef > Tasks > application > run
JabRef > Tasks > application > run

The Gradle run window opens, shows compilation and then the output of JabRef. The spinner will run as long as JabRef is open.

You might get an out-of-memory-exception as follows:

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000cb600000, 177209344, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)

You can close JabRef again.

After that a new entry called “jabref [run]” appears in the run configurations. Now you can also select “jabref [run]” and either run or debug the application from within IntelliJ.

You can run any other development task similarly.

Enable compilation by IntelliJ

This is currently not possible due to IDEA-3733059.

Using IntelliJ’s internal build system for tests

This is currently not possible due to IDEA-3733059.

Final build system checks

To run an example test from IntelliJ, we let IntelliJ create a launch configuration:

Locate the class BibEntryTest: Press Ctrl+N. Then, the “Search for classes dialog” pops up. Enter bibentrytest. Now, BibEntryTest should appear first:

IntelliJ search for class "BibEntryTest"
IntelliJ search for class “BibEntryTest”

Press Enter to jump to that class.

Hover on the green play button on defaultConstructor:

However on green play button
However on green play button

Then, click on it. A popup menu opens. Choose the first entry “Run BibEntryTest.testDefaultConstructor” and click on it.

Popup menu - Run testDefaultConstructor
Run BibEntryTest.testDefaultConstructor

Then, another popup menu opens. Choose “test” as the run task for the test.

Run Tasks for default Constructor
Run Tasks for default Constructor

Then, the single test starts.

You also have an entry in the Launch configurations to directly launch the test. You can also click on the debug symbol next to it to enable stopping at breakpoints.

Launch menu contains BibEntry test case
Launch menu contains BibEntry test case

The tests are green after the run. You can also use the play button there to re-execute the tests. A right-click on “BibEntryTests” enables the debugger to start.

Run window for the BibEntry test case
Run window for the BibEntry test case