Download and install the latest IntelliJ IDEA Community Edition: https://www.jetbrains.com/idea/download/
Change the IntelliJ maximum memory to 2 GB or more. As per the instructions, from the main menu choose Help | Edit Custom VM Options and modify the -Xmx and -Xms options.
Enable parallel builds in Preferences > Build, Execution, Deployment > Compiler > Compile independent modules in parallel.
Open IntelliJ and go to Preferences > Plugins > Browse Repositories. Install the following plugins:
- Eclipse Code Formatter: formats code according to Eclipse
- Checkstyle-IDEA: runs style checks as you develop
- Save Actions: allows code reformatting on save similar to Eclipse
- FindBugs-IDEA: looks for suspicious code
- Python Plugin: python plugin
- Markdown Navigator: markdown plugin
Make sure you have mx
installed and updated (mx update
). Then, to initialize IntelliJ project files, go to the root of your project and invoke: mx intellijinit
Open the folder of your freshly initialized project from IntelliJ (IntelliJ IDEA > File > Open…). All depending projects will be included automatically.
Configure the Eclipse Code Formatter
(IntelliJ IDEA > Preferences > Other Settings > Eclipse Code Formatter):
- Set "Use the Eclipse code formatter"
- Choose the right version of the formatter for your project (e.g., 4.5 vs 4.6)
Set IntelliJ to use the Eclipse compiler by going to IntelliJ IDEA > Preferences > Build, Execution, Deployment > Java Compiler To make IntelliJ work the same way as Eclipse with respect to Problems View and recompilation you need to:
- In preferences set the "Make project automatically" flag.
- Open the problems view: View > Tool Windows > Problems
- Navigate the problems with Cmd ⌥ ↑ and Cmd ⌥ ↓
This section describes how to set up Eclipse for Graal development. For convenience, $GRAAL
denotes your local Graal repository.
Eclipse can be downloaded here. The currently recommended version for Graal development is 4.7.3a ("Oxygen").
Once you have installed Eclipse, if you have multiple Java versions on your computer, you should edit eclipse.ini to specify the JVM that Eclipse will be run with. It must be run with a JDK 9 or later VM. For example:
-vm
/usr/lib/jvm/jdk-9.0.4/bin/java
When first launching Eclipse, you should create a new workspace for Graal development. Select the parent of $GRAAL
as the workspace as you will also be importing projects from the suites that Graal depends on.
The configurations created by the mx eclipseinit
command binds projects to Execution Environments or JREs corresponding to the Java compliance level of the projects. You need to configure these Execution Environments and JREs as follows:
- From the main menu bar, select Window > Preferences.
- On the left, select Java > Installed JREs
- Ensure there is an installed JRE with the name
jdk-11
. - Select Execution Environments and configure the JavaSE-1.8 environment.
- Click OK
Run mx eclipseinit
to create the Eclipse project configurations for all the Java projects then use the Import Wizard to import the created/updated projects:
- From the main menu bar, select File > Import... to open the Import Wizard.
- Select General > Existing Projects into Workspace and click Next.
- Enter the parent of the
$GRAAL
directory in the Select root directory field. - Under Projects select all the projects.
- Click Finish to complete the import.
Any time Eclipse updates a class file needed by the Graal runtime, the updated classes are automatically deployed to the right place so that the next execution of the VM will see the changes.
After updating your Graal sources and re-running
mx eclipseint
, a new Eclipse projects made be created and old ones removed. This usually results in an Eclipse error message indicating that a project is missing another required Java project. To handle this, you simply need repeat the steps above for importing projects.
In order to debug Graal with Eclipse, you should launch Graal using the -d
global option as described Debugging.