Skip to content

Importing into IntelliJ

TomGruene edited this page Oct 13, 2023 · 17 revisions

IntelliJ IDEA Community Edition can be downloaded for free from here.

Import the project in IntelliJ

  • Start IntelliJ and press the button Get from VCS on the welcome screen or go to File | New | Project from Version Control….
  • Enter the Git-URL https://github.com/OpenRoberta/openroberta-lab.git or [email protected]:OpenRoberta/openroberta-lab.git and press the button Clone. If you have already cloned our repository, there is no need to instruct IntelliJ to clone it again. In this case you can simply point IntelliJ to your local repository via File | New | Project from Existing Sources….

IntelliJ setup

Befor you start

If you are using Ubuntu 22 or higher, you need to disable the JCEF in the IDE by adding the following line to the VM options file.

  • Go to Help | Edit Custom VM Options.
  • Add the line -Dide.browser.jcef.enabled=false and save.

Set JDK version

  • Go to File | Project structure… and make sure that SDK is set to 11. Acknowledge with OK. This is very important even if a later JDK version is available on your system. In case 11 is not a selectable option, install JDK version 11 on your machine first.

Adding the custom code style formatter

We have designed our code style formatter for Java (Javascript and Typescript only works in the IntelliJ Ultimate edition and not in the IntelliJ Community edition, we are using VS code instead)

  • Go to IntelliJ IDEA/File | Settings… | Editor | Code Style, click on the gear icon, select Import Scheme | IntelliJ IDEA code style XML, navigate to openroberta-lab/Resources/formatter/openRobertaIdea.xml and click Apply.
  • The Scheme openRoberta should now be selected.

Configuring Actions on Save

In order for our code style to be applied to your changes, IntelliJ must be instructed to automatically apply the style each time you save.

  • Go to IntelliJ IDEA/File | Settings… | Tools | Actions on Save and tick Reformat code, Optimize imports and Run Prettier.
  • Hover your mouse over Run Prettier and click Configure…. Make sure ~/IdeaProjects/openroberta-lab/node_modules/prettier is defined as Prettier package and that On 'Reformat code' action and On save are checked.

Add some Run Configurations

Go to Run | Edit Configurations….

maven test

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose Maven.
  • Change the Name to maven test.
  • In the Command line field enter test.
  • Click Apply.

maven clean install

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose Maven.
  • Change the Name to maven clean install.
  • In the Command line field enter clean install.
  • Click Apply.

Integration tests

This action runs a series of tests to ensure that all cross compilers are working correctly. If you have not yet installed all cross compilers, an error message will be displayed after some time.

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose Maven.
  • Change the Name to Integration tests.
  • In the Command line field enter clean install -PrunIT.
  • Click Apply.

npm run build

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose npm.
  • Change the Name to npm run build.
  • Make sure the Command is set to run.
  • Choose build in the Scripts field.
  • Click Apply.

npm run watch

This action does the same thing as npm run build. While npm run build runs the process exactly once and then stops, npm run watch remains active and continuously checks the source files for changes. Once changes are detected, the file is processed immediately. This saves you from having to run npm run build every time you make a change.

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose npm.
  • Change the Name to npm run watch.
  • Make sure the Command is set to run.
  • Choose watch in the Scripts field.
  • Click Apply.

Server Starter

  • In the window Run/Debug Configurations press the button + in the upper left corner, choose Application.
  • Change the Name to Server.
  • Choose the module OpenRobertaServer in the -cp field.
  • In the Main class field enter de.fhg.iais.roberta.main.ServerStarter.
  • In the Program arguments field enter -d server.staticresources.dir=./OpenRobertaServer/staticResources -d robot.crosscompiler.resourcebase=../ora-cc-rsc.
  • In the menu Modify options tick the entry Code coverage | Specify classes and packages.
  • Under Code Coverage click Add Package… and enter the path de.fhg.iais.roberta.main.*.
  • Click Apply.
Clone this wiki locally