Addon development

@David_Graeff
Looks like I’m good up to this point. Not sure what you mean by this part. I have a generic karaf console in debug right now - I tried to deploy the allplay bundle but get “missing osgi.wiring.package (org.eclipse.smarthome.config.core)”. Since you said “openHAB karaf” - I think I’m missing something in your instructions.

Likewise, if you could post your launch.json - would be fantastic as well

EDIT: wait - do you mean start a normal openhab karaf with the debug option? I assume the launch.json would then copy the built jar to the addons directory?

EDIT2: okay - that worked much better. I was able to connect to a running openhab karaf/debug instance and walkthrough the code. I just need to add to the launch to build and copy to the addons directory…

EDIT3: alright - I now have a tasks.json/launch.json that will build, copy the resulting jar from target to my openhab addons and start debugging. Seems to be working fine. I’ll post some instructions tomorrow.

QUESTION however - is there anyway to force karaf to reload a bundle? Doing the copy of the jar - I have to wait a bit for the watcher to notice it and reload the bundle. Was hoping there was a way to short circuit that…

Thanks,
Tim

1 Like

The java debug protocol can maybe also transfer the bundle. Alternatively maybe karaf has a protocol.

I haven’t done more than you yet. I assume there must be an almost instant way, back in the old days it worked by starting a karaf from within the eclipse ide and injecting the bundle.

What is responsible for reloading is the Apache Felix fileinstall service. Maybe that can be triggered via a console command to re-check files.

openhab-android is already using Gradle :slight_smile:
I don’t know the advantages/disadvantages of each build system, but the main goal should be the development experience.
Right now Eclipse has infinity loop error. Personally, I’ve tried setting everything up 3 times, but I gave up.
It is extremely hard to start with binding development.

The main goal should be: how to allow new users (like me) to start development in the easiest way.
Ideally user should clone repo, open project in IDE (user preffered) and just start development.
I don’t have nothing against Eclipse, but it is so terrible slow. Why not go with VS Code?

@David_Graeff do You think it would be worth to migrate to Gradle right now? Maybe with OH3?

But you have read this thread, have you? ^^ hint: it’s about Vscode.

And we only have performance problems with the build atm because of maven. So yes maybe a change to gradle have do be done as well before we can provide a smooth developer experience. There is no non enterprise project out there that uses karaf and OSGi. We are really on our own and on uncertain terrain.

Yes, I’ve read the thread and I’m more than happy that VS Code is under consideration as THE developmen ide. VS Code is lightweight, fast, has large community and gets bug fixes and new features really fast.
When it comes to maven vs gradle I’m not an expert, but smooth developer experience should be top priority.

@Misiu @David_Graeff
The one glaring issue with VSCode is the lack of Nullable annotation checking. Yes - you do get those on the maven compile just not as you’re coding (Intellisense) and I can’t seem to find an extension that handles it.