I have spent the last 2 days trying to get a full development build running and I am at the point now where I can actually get to start/run the demo app using the osgi buttons.
I am new to java/maven/eclipse having come from vs .net so any advice as to what to do to resolve below error would be appreciated. I have only copied in the first few.
I have re-installed again and investigating why the projects in core have errors they all relate to to pom.xml and itest.bndrun.
However when I try and run the test I am getting a different set of errors depending on which version of java I target. This is a truncated version of the console with java 11.
OK that explains. In Java 11 javax.xml.bind is no longer available by default. It’s best to use Java 8 when doing development on the 2.5.x branches.
In the master branch (OH3) Java 11 is supported/required. It is possible to use Java 11 with the 2.5.x branch. However you first need to update the bndrun files like I did in:
You can then update
-runee: JavaSE-9
to -runee: JavaSE-11
in app-java9plus.bndrun
and use that bndrun file for launching OH 2.5.x with Java 11.
I merged back those changes from the master to 2.5.x so it’ll be easier to switch between those branches while running Java 11, so if you update the branch you should be able to use it straight away, see:
Now that it is running , regardless of the fact i can’t login is great but I not sure if the demo is for a 2.5 or 3 core and how do i switch between them.
fetch changes from the origin (if that’s the name of your upstream OH remote)
rebase your branch on origin/2.5.x
That can be done using the IDE or command line. If you’re working on a new add-on there’s typically no reason to update the addons, unless you want to sync the version numbers.
Sometimes it already automatically makes some changes after importing projects. You can probably revert those.
The next step could be to see if you can also debug an existing add-on like astro:
After that you can help fixing one of the hundreds of issues or maybe enhance an existing addon Once you know how that all works you might take on something more complicated like building a new add-on.
my OH addons folder in the project was empty so i did a git reset --hard HEAD and the pull request then worked and I added the folder to the workspace doing a folder import.
followed the rest of the guide and can see the astro binding in the paperui.
I cant work out now how to get into the debugger to set any break points as I have never used eclipe or java and I think something is also wrong with the addons as all I see is the name of the binding with no subfolders/src code visible
I’ve created a PR so there are no longer unstaged changes after importing projects and it also fixes almost all errors:
You can toggle a break point on/off in Eclipse by double clicking at the beginning of a line of code so you see a small blue dot. Another way is right clicking at the beginning of the line so you’ll see a menu that has the “Toggle Breakpoint” option.
In the screenshot below I enabled two breakpoints in the initialize and dispose methods of the AstroThingHandler so you can debug the initialization and disposal of Astro Things.
As you can see on the right there’s also a “Breakpoints” view that lists all breakpoints. It’ll probably show automatically when you open the “Debug” perspective when you click the bug icon in the top right corner.
Also make sure when you start the application you use the “Debug OSGi” option instead of “Run OSGi” or it will not use the breakpoints.
Thanks for all of the help so far. Had a bit of an attempt to get the current install working but had no success and I am waiting for a fresh install to finish.
Unfortunately in the same situation still. I can add the astro binding and run in debug but there is no source in the project for the addons and the addons folder is empty in eclipse.
It doesn’t import any add-ons automatically. These need to be imported manually because Eclipse doesn’t perform well when all add-ons are automatically imported.
If you have selected openHAB Add-ons the installer will clone the openHAB Add-ons repository.
To get an existing binding project into Eclipse import it as a Maven project.
Goto File → Import... → Maven → Existing Maven projects and follow the wizard to select the directory of the binding or bindings to import.
I have successfully loaded the astro binding into the project and set the breakpoints and the astro binding is running. However the breakpoints were never hit and I don’t see any debug info.