- Loading...
...
Eclipse is a popular IDE that is used by many committers to develop Java code. Eclipse projects project files (.project and .classpath) have been created for you to useand checked into the repository. You should use the latest Eclipse version, or at least a version that supports JDK N-1 (for OpenJFX N) after patching (see below on patching).
It's recommended that location of the local git repository not be inside the Eclipse workspace directory.You should take advantage
OpenJFX is built using Gradle, which uses the javac compiler (even when run through Eclipse), and uses the Gradle wrapper to specify its current version. Various tasks, such as testing, are also configured through Gradle. However, you can still use Eclipse's compiler (ECJ) to take advantage of its speed as an incremental compiler, and of Eclipse's incremental compiler and faster unit tests compared to gradle tasks, however, you still need gradle for the runner. Gradle is mandatory for the following phases:
gradlew or /.gradlew build) that generates resources that are needed for the build.specified in the Eclipse projects dependencies, and to verify that you can build with javac. You can either use gradle Gradle from the command line or use Buildshipthrough Buildship, which integrates Gradle into Eclipse.
You can either import the projects as Java projects and then run the Gradle build manually ( from a command line), or import them directly as Gradle projects with Buildship (in which case you can run the Gradle tasks and use Gradle from within Eclipse). In either case, you might find it convenient to use Working Sets, which you can configure during the import or later.
. If you import as Java projects, you can later also import them as Gradle projects to add Buildship's functionality to them.
To import as Java projects:
File -> Import -> General -> Existing Projects into Workspace.Search for nested projects.FinishEclipse has Gradle support via Eclipse Buildship. Use the latest Buildship version, as the Gradle version used in OpenJFX updates from time to time and Buildship needs to support that Gradle version. OpenJFX uses the Gradle wrapper The Gradle Tasks view will list all the tasks that are configured in OpenJFX.
The project structure for Gradle is such that the root directory contains the parent project (called jfx, or previously rt) with all other projects being its children. The Gradle Tasks view will allow you to execute the tasks that you would use Cygwin for otherwise.
NOTE: this process will override the projects' Eclipse configuration files that come with the repository, and will cause them to not work anymore. This is because Gradle/Buildship does not know yet how to create the correct configuration files by itself. However, since we are inside using a git repository, we can revert the breaking changes and keep the Gradle settings. This will allow us to work with both Eclipse and Gradle/Buildship.
File -> Import -> Gradle -> Existing Gradle Projects.Gradle wrapper.Finish and wait for the workspace to rebuild. This will result in many compilation errors as described in the note above.
Revert all .classpath and files (and clean and rebuild if it does not happen automatically - this will some take time). There should be no compilation errors.
What this process does is add the Gradle nature and build command to the .project files. This means that these files are now different than the ones in the repo. Additionally, the .settings folder for each project will contain a Buildship pref file. You will need to resolve the conflicts with the upstream repo.
To import as Java projects:
File -> Import -> General -> Existing Projects into Workspace.Search for nested projects.FinishWindow -> Preferences -> Java -> Installed JREs and Add and select the above -> Standard VM and point to the latest version. If you want to find a regression or backport, you can switch to earlier versions here under Installed JREs (will require rebuilding). You might see a warning that Eclipse does not support this Java version, this should not cause issues.Window -> Preferences -> Java -> Compiler and set the compiler compliance level to the latest. You might not have an option for an unreleased version of Java. For example, if compliance level 11 is not available, install the patch from the update site: http://download.eclipse.org/eclipse/updates/4.9-P-builds/. Similarly, for Java 13 use: https://download.eclipse.org/eclipse/updates/4.13-P-builds....
NOTE: Dialog.java in the controls module currently gives a compiler error because of a bug in Eclipse. It can be worked around be moving the erroneous line out of the lambda expression. Remember to ignore this change when working against a revision.
Eclipse can run JUnit tests as an alternative to the gradle Gradle tasks.
Right click on the resource you want to test (project/package/class) and select Run as -> JUnit Test.
...
-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit
When running test.javafx.scene.web.WebViewTest, instead of the -Djavafx.toolkit argument, use:
-Djava.library.path=<path to repo>/modules/javafx.graphics/build/module-lib:<path to repo>/modules/javafx.web/build/module-lib
Working sets allow you to group projects. The projects in OpenJFX contain its modules projects, like base and graphics, but also the apps and test projects. If you do not use these, you can create working sets for them and hide them.
Having an external project that uses the development OpenJFX modules is useful for debugging and testing.
...