add IntelliJ developer setup HowTo (#1127)

* add IntelliJ developer setup HowTo

Signed-off-by: pravussum <pravussum@users.noreply.github.com>
Signed-off-by: Robert Bach <openhab@mortalsilence.net>

* fixed minor formatting issue

Signed-off-by: pravussum <pravussum@users.noreply.github.com>
Signed-off-by: Robert Bach <openhab@mortalsilence.net>
Signed-off-by: pravussum <pravussum@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Robert Bach <openhab@mortalsilence.net>

* fixed heading hierarchy

Signed-off-by: Robert Bach <openhab@mortalsilence.net>

Co-authored-by: Jerome Luckenbach <github@luckenba.ch>
pull/1135/head
pravussum 2020-01-06 18:17:26 +01:00 committed by Jerome Luckenbach
parent 711d04487e
commit c237a7f755
2 changed files with 34 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -5,7 +5,37 @@ title: IntelliJ
# IntelliJ IDE
::: tip TODO
We are currently reworking how to setup a perfect development enviroment.
A new step by step guide will appear here soon.
:::
## Prerequisities
- git, Maven, IntelliJ and Java 8 are installed
## Install OpenHAB distribution
1. Install the official [openHAB distribution](https://www.openhab.org/download/)
1. Start the distribution **in debug mode** (use `./start_debug.sh` instead of `./start.sh` in step 4)
This article refers to the directory where you installed the distribution as `<DISTRO_DIR>`.
## Build the addons repostory
1. fork and clone the [openhab addons repository](http://www.github.com/openhab/openhab-addons) into a new directory (Reference `<ADDON_DIR>` from now on for this arcticle)
- `git clone https://github.com/<yourgitusername>/openhab-addons` (replace git user name accordingly)
1. open IntelliJ and create a new Project from existing sources (File | New | Project from existing sources) and pick `<ADDON_DIR>`/pom.xml
- IntelliJ will start importing, indexing and building, it will take while, wait until finished (see status bar)
1. Use Maven to clean & install the addons project
- mvn clean install in the root of `<ADDON_DIR>` using commandline Maven (or IntelliJ Maven view)
- some of the addons might fail to build - if it's not the one, you're interested in that should not bother you
- when the Maven project finished, you should find the freshly built addon JAR in the target directory
## Debug your addon
1. copy the addon JAR to Openhab distribution created before
- `cp target/<ADDON_NAME>.jar <DISTRO_DIR>/addons`
1. The running instance of the openhab distribution should pick up your new addon & start it
- you can type `log:tail` in the openhab console to stream the openhab logs
1. create a Remote Debug runtime configuration in IntelliJ:
- Open menu Run | Edit configurations
- click the + sign to add a "Remote" configuration
- adapt the module setting to the root (org.openhab.addons.reactor)
- click OK
- start the debug configuration
- the IntelliJ console should log: `Connected to the target VM, address: 'localhost:5005', transport: 'socket'`
![Remote Debug Run Configuration](images/ide_setup_intellij_debug_configuration.png)
You can now add breakpoints to your project now and your test distro should stop there.