How to structure projects using Eclipse for Openhab2

Looking for advice concerning development of sitemap, items etc using the openhab2 eclipse.

I’ve setup eclipse according to:

So far I have been writing my sitemap, items, rules etc using nano, going to try and move over to using the eclipse ide.

Is there any documentation or instructions for how to start developing
on your own sitemap/item/rules resource project?
I’m thinking in terms of how to create the project, project structure and such.

My goal is basically to push my changes in the sitemap, items whatnot into my own local git repo (already setup), and then do
a git pull on my rasberrypi running openhab2 when I’m satisfied with the changes.

I guess I can copy past from the pom file infrastructure/demo-resource, is that the right approach?

Thanks in advance,

Eclipse IDE is intended for developing OH 2, and OH 2 bindings. For now, you should use a combination of PaperUI and the old openHAB1_Designer.

When you open Designer you point it at your configurations folder. It will load all of the config files from there. You ca create new files using <ctrl>n. Make sure you are highlighting the section you care about. When typing rules, you can use <ctrl><space> to get a list of valid completions to what you are typing, handy for discovering methods on objects.

Warning: in the latest Designer something broke its ability to recognize “now” so it highlights all references to now in red. This is a bug in Designer, not in your rule.

As far as the git repo stuff is concerned. The way I manage it is I copied my configurations, jetty, and webapps folders into my local repo and created symlinks from there to their appropriate locations (e.g ln -s ~/openhab-configurations/configurations /etc/openhab/configurations). All the files that I have or may change are in this one folder and get configuration managed through git and the symlinks let me keep OH up to date without needing to move or copy files around.

1 Like