[Solved] Setup IDE for JSR223 Code Completion

I am currently upgrade my JSR223 Python rule to Groovey and need some support to setup my IDE correctly. Since my editor offers code completion, I would like to refer the Eclipse Smarthome code to use this feature. Therefore, I downloaded the last source code version and put it in /conf/lib/esh. After that, I marked this folder as “Source Folder” in my IDE. Unfortunately, it only works for some of the classes. I guess the issue is releated the namespace and the file location. If I open an ESH class, I can see some warning regarding the class path.

Can someone tell me which folder of the ESH source code I need to mark as “Source Folder” so that ESH packages are appearing in the namespace scope?

I am using the IntelliJ IDEA IDE by the way but the problem should be the same for all editor.

I found a suitable solution

  1. Download ESH Libraries via Maven (pom.xml attached)
  2. Add the maven repositories as external library to your IDE

Now you can use the code completion for ESH classes.

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>dev.openhab</groupId>
    <artifactId>openhab</artifactId>
    <version>1.0-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>Eclipse</id>
            <name>Eclipse</name>
            <url>https://repo.eclipse.org/content/groups/releases/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.api</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.module.script</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.sample.java.demo</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.config</groupId>
            <artifactId>org.eclipse.smarthome.config.core</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component</artifactId>
            <version>1.3.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.module.timer</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.providers</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.module.script.rulesupport</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.automation</groupId>
            <artifactId>org.eclipse.smarthome.automation.module.core</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.smarthome.model</groupId>
            <artifactId>org.eclipse.smarthome.model.script</artifactId>
            <version>0.9.0.b6</version>
        </dependency>
    </dependencies>
</project>