Skip to content

Setting up an IDE

Enrico Girotto edited this page Apr 10, 2024 · 19 revisions

This wiki page contains information needed to set up the recommended IDE for the k.LAB project.

The strategy is to build the project via command line with Maven and then import it into Eclipse

Requirements

How to install Java

Go to the Eclipse Temurin and download the latest version of Java 17 for your operative system (Linux, Windows, MacOS).

For Linux systems

Choose where do you want to install Java. For example, /usr/java.

Extract the downloaded .tar.gz file (tar xvf) and move its content to that directory.

Check if Java JDK 17 is installed by running java --version. If not, run update-alternatives --config java and choose the correct version.

For Windows systems

Choose where do you want to install Java. For example, C:\Program Files\Java.

Unzip the downloaded file and move its content there.

Update the PATH and JAVA_HOME variables

In the Control Panel go to System, click Advanced and then System Variables.

Create a new System Variable named JAVA_HOME. Use the path to the Java folder as the variable name.

Add %JAVA_HOME%\bin to the Path.

Apply the changes. Check the Java version in the command line by running java --version.

Installation steps

Clone and build the project

You need to install Java and Maven. Make sure JAVA_HOME environment variable is properly configured, and $JAVA_HOME/bin is part of your $PATH

$ git clone [email protected]:integratedmodelling/klab.git
$ cd klab
$ MAVEN_OPTS="-Xmx2g" ./mvnw clean install -DskipTests

💡 Note: Change ./mvnw for mvnw.cmd on Window systems

Download Eclipse IDE

Download Eclipse IDE for Java and DSL Developers, version 2022-09 and install it.
Be sure to download the JAVA and DSL Developers package, the 5th in the list

This tutorial will assume that the user has downloaded the recommended version. Errors caused by alternative IDEs or versions are not covered in this tutorial.

Disable build automatically

⚠️ This is an important step ⚠️

After the initial startup and before any other step, you must disable Build Automatically option.

build

Install the plugins

Download the following plugins from the Eclipse marketplace.

Go to menu option Help > Eclipse Marketplace... and search and install for the following plugins:

  • Groovy Development Tools

  • Eclipse Nebula Incubation Widgets

  • Eclipse Nebula Stable Widgets

  • Lombok:

    We need to get the Lombok jar first. The latest version is located on [Maven Central] (https://mvnrepository.com/artifact/org.projectlombok/lombok).

    For our example, we’re using lombok-1.18.32.jar.

    Next, we can run the jar via java -jar command, and an installer UI will open. java -jar lombok-1.18.32.jar

    This tries to automatically detect all available Eclipse installations, but it’s also possible to specify the location manually.

    Once we’ve selected the installations, we press the Install/Update button:

    image

Import the project

After installing the required plugins and restart Eclipse. You can import the built project into your workspace.

See: Importing existing projects from Eclipse documentation.

Configuration

Modify the API baseline error

After importing the project, the IDE might complain about an error regarding the API baseline.

Despite being marked as an error, this issue does not affect the project. Therefore, the severity can be safely lowered to a warning. Right click on the error and select "Quick fix".

Error API baseline

On the next window, select "Configure API problem severity" and "Finish".

Quick fix

At the new window, modify the "Missing API baseline" level to "Warning". Apply changes and recompile.

API baseline

Set the compilation target to Java 11

The project is ready to work with Java 11. The compiler compliance level con be seen at the "Preferences" menu. Go to "Java"->"Compiler" to see the options for the compiler version.

Java 11

Modify the JRE definition for the project

By default, Eclipse uses its own JRE, which causes some compatibility issues at the k.LAB projects. To modify the default JRE definition go to the "Preferences" menu. Then, "Java"->"Installed JREs".

2023-12-07_827x575

In this screen, select "Add.." and include OpenJDK 17 (see the section about requirement) to the build path.

2023-12-07_600x582

Select the new JDK as the default definition, save and close.

2023-12-07_827x575-selected