openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

"How to develop in the Eclipse IDE" does not work. #5572

Closed FischertBilligheim closed 4 years ago

FischertBilligheim commented 5 years ago

The description how to debug/develop a binding does not work on my Windows-10 machine.

I installed the Eclipse-IDE in "advanced-mode" using the "openHAB Add-ons" Project. With that Installation the descriptions works pretty well - but I have 2 problems:

1) It's not possible to drag-drop my example/test "Serial-button"-binding like described to the "Run-requirements". An error box pops up:

runRequirements

2) If I start my browser with "http://localhost:8080" - the Access is forbidden…. It seems, that "localhost:8080/paperui/index.html" must be used….. This should be described in the docu…

OSGI-Console

Gozilla01 commented 5 years ago

Start by installing from the latestlatest version (03-2019), do not select any additional components. Then follow the new documentation https://deploy-preview-968--openhab-docs-preview.netlify.com/docs/developer/#eclipse-ide-setup @Confectrician The pages of the documentation do not work

Confectrician commented 5 years ago

The pages of the documentation do not work

Can you give some more details which pages areas especially are affected?

Gozilla01 commented 5 years ago

yesterday the PR was merged with the Eclipse installation update. If you use the official website of the documentation the web page from loading error. For this I have attached the preview link. sorry but I'm not in front of the computer

FischertBilligheim commented 5 years ago

The preview looks very good - and exactly covers my problems/experiences I had the last days!!!
This evening, I will test this new description!! Thanks really a lot for that !!

Confectrician commented 5 years ago

Ah now i get it. Yes there is some trouble with the website build currently. This may also be the reason for that page not being updated.

davidgraeff commented 5 years ago

Please remind me when the website is updated to also update the readme file of this repo. Thanks.

FischertBilligheim commented 5 years ago

I tested the new documentation with the link from Gozilla01. The creation of the Skeleton-binding Shows an error - on my Windows10-machine (I use the "create_openhab_binding_skeleton.cmd" Batch. This is the error:

Skeleton2

davidgraeff commented 5 years ago

Yes that was moved. Remove the "karaf" part of the path in the batch file.

Edit: Oh. That is not in our repo, that is part of the archetype itself in the core repo and I had that fixed already: https://github.com/openhab/openhab-core/commit/ff7008438358add7ce89d7b0dce4fc5beccda36f

Are you sure you have checked out a recent version?

FischertBilligheim commented 5 years ago

Mmmmh - interesting. :-) I currently don't have the "openhab-core" repo mapped on my machine - but it exists in the repository: "C:\Users\Thomas.m2\repository\org\openhab\core" - and here the "karaf" Folder exists…...

FischertBilligheim commented 5 years ago

I meanwhile created a Karaf-folder in my repo and copied the "openhab-addons" Folder into it. Now I can generate the Skeleton binding.

Also the "mvn -DskipChecks -DskipTests clean install" worked. But this new binding cannot be seen in the "app.bndrun" Editor on the left side:"Repositories". If I'm adding the new Skeleton-Binding by using a text.editor, the "Resolve" does not work….

davidgraeff commented 5 years ago

I meanwhile created a Karaf-folder in my repo and copied the "openhab-addons" Folder into it.

That might have triggered a redownload of openhab-core. And your other checkout works as well now.

mvalla commented 5 years ago

But this new binding cannot be seen in the "app.bndrun" Editor on the left side:"Repositories".

Try to close Eclipse and do a “mvn -DskipChecks -DskipTests clean install“ from the openhab-demo project main folder. Then open Eclipse and you should now see the new binding listed.

I currently don't have the "openhab-core" repo mapped on my machine - but it exists in the repository

That is normal : of course the whole setup depends also from openhab-core project(s) so even if you did not checked it out using git, it has been downloaded by maven as a dependency and put in your local repository.

procrastimax commented 5 years ago

I still run in the same problem of missing Karaf folder. I setup everything with the updated Setup-Guide: https://deploy-preview-968--openhab-docs-preview.netlify.com/docs/developer/#eclipse-ide-setup

This works so far in terms of adding existing bindings.

But when I try to create my own binding with the createskeleton...sh script, I get the same mvn error like @FischertBilligheim. But creating a karaf folder and copying the openhab-addon folder into karaf doesnt work, since there is no feature.xml in my openhab-addon folder. (And I also think that this cant be the solution). Is there anything else I can try?

davidgraeff commented 5 years ago

If you really want to work with your old openhab-core checkout (because the archetype skeleton is fixed in core for sure) you must restore the old directory structure: /features/karaf/openhab-addons/src/main/feature/feature.xml

procrastimax commented 5 years ago

Ok ok, no I just started with OpenHab2 dev, so I dont need the old core. I work with the openhab2 demo from maggu, does this demo uses the old core?

davidgraeff commented 5 years ago

Usually not. But it also doesn't update your openhab-core once it has downloaded it. You need to do "mvn -U" on the command line or use the respective Eclipse menu to trigger an update.

If in doubt just copy /features/openhab-addons/src/main/feature/feature.xml -> /features/karaf/openhab-addons/src/main/feature/feature.xml. That modification is not important anyway, since a few days we handle it differently, but that doesn't affect your binding development.

procrastimax commented 5 years ago

Creating an empty feature.xml in the karaf directory seems to work. But not the mvn ... -U way.

@davidgraeff sorry that this is not the right issue for this, but I cant mvn -DskipChecks -DskipTests clean install the openhab2-addons. It throws lots of compilation errors: f.e. Compilation failure: [ERROR] /home/max/code/java/test/openhab2-addons/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonTime.java:[17,476] The import com.google cannot be resolved [ERROR] /home/max/code/java/test/openhab2-addons/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonTime.java:[28,797] SerializedName cannot be resolved to a type [ERROR] /home/max/code/java/test/openhab2-addons/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonTime.java:[31,854] SerializedName cannot be resolved to a type [ERROR] /home/max/code/java/test/openhab2-addons/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java:[1] The type org.slf4j.Logger cannot be resolved. It is indirectly referenced from required .class files [ERROR] /home/max/code/java/test/openhab2-addons/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java:[1] The type javax.measure.Quantity cannot be resolved. It is indirectly referenced from required .class files

etc...

Is there a quick fix for this?

EDIT: Nevermind, after a couple of reboots and updating all mvn dependencies I can rebuild the openhab2-addon bindings with maven. But adding new bindings still only works with create/copy a karaf directory.