IntelliJ IDEA

1. Setup IntelliJ IDEA for OpenEMS Edge and Backend

  1. Prepare Intellij IDEA

    1. Download Java Development Kit (JDK) 11 and install it. We recommend the OpenJDK Temurin builds by the Adoptium project

    2. We use the Amdatu Plugin. Please confirm that the plugin is compatible with the latest version. See the Amdatu homepage .

    3. With the toolbox you can select the right version Intellij Version .

    4. To avoid incompatible updates, you may disable Auto-Updates in the Toolbox. It is also possible to select a earlier version if the update was done accidentally

    5. Search under Plugins "Amdatu" und "Checkstyle"

      Settings
      Figure 1. IntelliJ settings
      Plugins
      Figure 2. Install plugins
    6. Preparing your project with intellij

      intellij project import
      Figure 3. IntelliJ project import from existing source
      intellij select directory
      Figure 4. Select directory to import
    7. Select Bnd/bndtools

      intellij import bnd
      Figure 5. Bnd import
    8. Build OpenEMS Edge in IntelliJ

      intellij build gradle
      Figure 6. build.gradle
    9. or alternativly make an configuration "edit configuration"

      intellij add configuration
      Figure 7. build gradle over configuration
    10. creating a new module

      intellij new module
      Figure 8. creating a modul

      Rightclick on an existing module: New → Module

      Amdatu→ Project Template Project (Stringtemplate)

    11. add Support for Eclipse Code Formatting

      Search for 'Adapter for Eclipse Code Formatter' in the Plugin store

      intellij code formatter
      Figure 9. download Adapter for Eclipse Code Formatter

      After restarting the IDE go to Settings → Other Settings → Adapter for Eclipse Code Formatter

      intellij code formatter settings
      Figure 10. Adapter Settings

      Check the radiobutton for "Use Eclipse’s Code Formatter"

      intellij code formatter enable
      Figure 11. Enable Adapter

      Type in your Eclipse installation folder

      intellij code formatter path
      Figure 12. Set Eclipse Path

      Choose 'Eclipse [built-in]' as a formatter config

      intellij code formatter format
      Figure 13. Choose Format

      Now Reformat Code will use the Eclipse format (e.g. Use TAB instead of Whitespaces)

2. Hints - intellij problems

  1. If you have some problems - for example java version is not found: look in File → Project Structure → Project

    intellij java
    Figure 14. check java version
  2. If there is the module not correctly loaded, you can see that the blue square is not present

    intellij load modul
    Figure 15. not loaded modules

    This can be fixed via Tools → Amdatu → Refresh-Workspace. If it is still not working: File → Invalidate Caches/Restart