Skip to content

Commit

Permalink
Improve handling of annotation processor in eclipse
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Aug 9, 2020
1 parent d552369 commit 338f4db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ compileJava {
options.compilerArgs << "-Xlint:none"
dependsOn "generateSource"

options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/main/gen")

moduleOptions {
// TODO: Remove access to internal api
addExports = [
Expand All @@ -387,33 +389,32 @@ run {
addExports = [
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref',

'javafx.controls/com.sun.javafx.scene.control.behavior' : 'com.jfoenix',
'com.oracle.truffle.regex/com.oracle.truffle.regex' : 'org.graalvm.truffle',

// Not sure why we need to restate the controlfx exports
// Taken from here: https://github.com/controlsfx/controlsfx/blob/9.0.0/build.gradle#L1
'javafx.graphics/com.sun.javafx.scene' : 'org.controlsfx.controls',
'javafx.graphics/com.sun.javafx.scene.traversal' : 'org.controlsfx.controls',
'javafx.graphics/com.sun.javafx.css' : 'org.controlsfx.controls',
'javafx.controls/com.sun.javafx.scene.control.behavior' : 'org.controlsfx.controls',
'javafx.controls/com.sun.javafx.scene.control' : 'org.controlsfx.controls',
'javafx.controls/com.sun.javafx.scene.control.behavior' : 'org.controlsfx.controls',
'javafx.controls/com.sun.javafx.scene.control.inputmap' : 'org.controlsfx.controls',
'javafx.base/com.sun.javafx.event' : 'org.controlsfx.controls',
'javafx.base/com.sun.javafx.collections' : 'org.controlsfx.controls',
'javafx.base/com.sun.javafx.runtime': 'org.controlsfx.controls',
'javafx.web/com.sun.webkit' : 'org.controlsfx.controls',
'javafx.graphics/com.sun.javafx.css' : 'org.controlsfx.controls'
]

addOpens = [
'javafx.controls/javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/org.controlsfx.control.textfield' : 'org.jabref',
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',

'javafx.controls/javafx.scene.control.skin' : 'org.controlsfx.controls',
'javafx.graphics/javafx.scene' : 'org.controlsfx.controls',

'javafx.controls/com.sun.javafx.scene.control.behavior' : 'com.jfoenix',
'javafx.base/com.sun.javafx.binding' : 'com.jfoenix',
'javafx.graphics/com.sun.javafx.stage' : 'com.jfoenix',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,6 @@ Contributions to JabRef's source code need to have a code formatting that is con

![checkstyle settings](../.gitbook/assets/intellij-checkstyle-settings.png)

#### Troubleshooting when using both IDEA and Eclipse

If you have configured Eclipse for the same project \(the required steps are described below\), then the additionally added file `Log4jPlugins.java` must be excluded from the compilation process, otherwise an error will occur during the compilation of the project:

* **File \| Settings \| Build, Execution, Deployment \| Compiler \| Excludes** and add the following file to the

list \(\[+\]\), in order to exclude it:

* `src/main/java/org/jabref/gui/logging/plugins/Log4jPlugins.java`

### 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)
Expand All @@ -208,12 +198,10 @@ Make sure your Eclipse installation us up to date, Eclipse JEE 2020-03 or newer
* This step is only required once.
2. Run `./gradlew eclipse`
* **This must always be executed, when there are new upstream changes.**
3. Copy the file `Log4jPlugins.java` from `build/generated/sources/annotationProcessor/java/main/org/jabref/gui/logging/plugins` to `src/main/java/org/jabref/gui/logging/plugins/`
* Usually, the folder `plugins` must be created for that.
4. Open or import the existing project in Eclipse as Java project.
3. Open or import the existing project in Eclipse as Java project.
* Remark: Importing it as gradle project will not work correctly.
* Refresh the project in Eclipse
5. Create a run/debug configuration for the main class `org.jabref.JabRefLauncher` and/or for `org.jabref.JabRefMain` \(both can be used equivalently\)
4. Create a run/debug configuration for the main class `org.jabref.JabRefLauncher` and/or for `org.jabref.JabRefMain` \(both can be used equivalently\)
* In the tab "Arguments" of the run/debug configuration, enter the following runtime VM arguments:

```text
Expand All @@ -239,8 +227,8 @@ Make sure your Eclipse installation us up to date, Eclipse JEE 2020-03 or newer
```
* In the tab "Dependencies" of the run/debug configuration tick the checkbox "Exclude test code"
6. Optional: Install the [e\(fx\)clipse plugin](http://www.eclipse.org/efxclipse/index.html) from the Eclipse marketplace: 1. Help -&gt; Eclipse Marketplace... -&gt; Search tab 2. Enter "e\(fx\)clipse" in the search dialogue 3. Click "Go" 4. Click "Install" button next to the plugin 5. Click "Finish"
7. Now you can build and run/debug the application by either using "JabRefLauncher" or "JabRefMain". This is the recommended way, since the application starts quite fast.
5. Optional: Install the [e\(fx\)clipse plugin](http://www.eclipse.org/efxclipse/index.html) from the Eclipse marketplace: 1. Help -&gt; Eclipse Marketplace... -&gt; Search tab 2. Enter "e\(fx\)clipse" in the search dialogue 3. Click "Go" 4. Click "Install" button next to the plugin 5. Click "Finish"
6. Now you can build and run/debug the application by either using "JabRefLauncher" or "JabRefMain". This is the recommended way, since the application starts quite fast.
## Final comments
Expand Down

0 comments on commit 338f4db

Please sign in to comment.