Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine IntelliJ howto to enable built-in compiler again #6794

Merged
merged 14 commits into from
Sep 1, 2020
Merged
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 @@ -55,8 +55,9 @@ 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\).
Version 2020.2 does not work. Please use version [2020.1](https://confluence.jetbrains.com/display/IDEADEV/IDEA+2020.1+latest+builds).

Under 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.
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.

### Other Tooling

Expand Down Expand Up @@ -142,13 +143,20 @@ After that a new entry called "jabref \[run\]" will appear in the run configurat

You should use IntelliJ IDEA's internal build system for compiling and running JabRef during development, because it is usually more responsive. Thereby, **it's important** that you understand that JabRef relies on generated sources which are only build through Gradle. Therefore, to build or update these dependencies you need to run the `assemble` Gradle task at least once.

Note that these steps do not work on IntelliJ 2020.2.

To use IntelliJ IDEA's internal build system when you build JabRef through **Build \| Build Project** or use the provided "JabRef Main" run configuration, ensure that

* In **File \| Settings \| Build, Execution, Deployment \| Build Tools \| Gradle** the setting "Build and run using" and "Test using" is set to "IntelliJ IDEA".

* Ignore the Gradle project "buildSrc" by clicking the button **Select Project Data To Import** in the Gradle Tool Window and unchecking the folder "buildSrc".

![Ignore the Gradle project "buildSrc"](../.gitbook/assets/intellij-gradle-config-ignore-buildSrc.png)
* Add the folder `src/main/gen` as generated sources root
koppor marked this conversation as resolved.
Show resolved Hide resolved
![src/main/gen is generated](../.gitbook/assets/intellij-mark-src-main-gen-as-generated-sources-root.png.png)
koppor marked this conversation as resolved.
Show resolved Hide resolved
* Delete `org.jabref.gui.logging.plugins.Log4jPlugins`. Otherwise, you will see folowing error:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step should only be necessary for developers that used the old version (where the log4jplugin was created in a different folder).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After gradlew run, the file is generated. I checked it with latest master. Thus, the file always has to be deleted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be generated in "src/main/gen" because of https://github.com/JabRef/jabref/blob/master/build.gradle#L376. But that's exactly what it's designed to do. So I'm not sure why you would want to remove this file. It's needed to build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When removing it, the internal IntelliJ compiler perfectly compiles. When it is present, IntelliJ 2020.1 fails with the error.

Is it different on your side?

(I am not talking about the gradle build. I aim for offering all available build chains (IntelliJ build-in and gradle) to the users)


```text
Error:java: Unable to create Plugin Service Class org.jabref.gui.logging.plugins.Log4jPlugins
```

Essentially, you now have the best of both worlds: You can run Gradle tasks using the Gradle Tool Window and unless you haven't made changes to input files that generate sources, you can compile and run with IntelliJ's faster internal build system.

Expand Down