Hi @Misiu, did you install the latest (201903) version of Eclipse IDE? And also, without any of the repositories during install? Only import as existing Maven project afterwards?
As David said, the README in the Addons Github repository should get you going, at least to come to a setup without those compile/build errors.
Yes I’ve installed the latest version.
After launch I’ve created a new workspace then in Package Explorer I right click and choose Import.
I’ve picked up Maven->Existing Maven Projects and selected folder where I git openhab-demo.
After that I got this errors:
The container ‘Maven Dependencies’ references non existing library ‘C:\Users\Tomek.m2\repository\org\openhab\bundles\org.openhab.binding.synopanalyzer\2.5.0-SNAPSHOT\org.openhab.binding.synopanalyzer-2.5.0-SNAPSHOT.jar’
The project cannot be built until build path errors are resolved
I know it might not be best timing for this but you can do your binding alone without pulling in entire openhab. You need to pull in all necessary dependencies. Until addons are bnd-nized you can rely on simplistic maven approach. Take a look on below project - it has literally ONE line which set ups OSGi bundle activator.
If you want to have a proper binding create ESH-INF in your resources directory. OSGI-INF contents are generated by maven-bundle-plugin thus you just need to re-use existing annotations.
Most importantly - it works out of the box (with IntelliJ) and it should also work for other part of universe (Eclipse). Main drawback is - you need to install and update binding manually inside running openHAB instance via install file:/foo/bar/binding.jar and update <binding-id> or watch commands (you can find reference in Karaf manual).
Above way is less convenient than IDE driven development, but works quite reliability for most of people.
Łukasz,
Binding (MCP23017) that I want to base my new binding on is already building on BND, so I’ll try with eclipse.
I’ll check Your suggestions tommorow, maybe it will be easier for me to get started.
The whole process of setting up everything is complicated. In Visual Studio it is simple - You click on csproj file and Your ready to go. This should be as easy with openhab
P. S.
I’m running openHAB 2.4, will I be ae to add binding based on BND to it?
Yes, it’s gonna work. BND changes way how build is organized but does not change runtime. As long as output of compilation contains all necessary metadata it will pass.
If yo uused Visual Studio before then its worth to try IntelliJ anyway, sometimes its less verbose and seems to be easier for new comers. It is able to import most of maven projects. I’m not sure if it properly supports BND workspaces, but that’s something which is not required to work inside IDE to write your Java code.
I’m not so sure. I think @J-N-K has found out that a version restriction is currently compiled in (minimum OH 2.5-snapshot), but maybe he can elaborate more on this topic.
I think the version was an earlier problem but that has been removed. I at least had no problem using newer versions on a 2.4
However, if the binding now gets the jar from maven dependencies, were it before had that jar in the lib directory. I think these need to be installed manually because that information is in the feature file.
Have you performed what I mentioned earlier about the “resolving” part?
Nevertheless, let’s ask @maggu2810. Can you have a look at the post from @Misiu above? Looks like the libraries that are in “lib” directories are not resolved.
I’ve tried all the possible thing I can think of.
I’ve imported project in different ways, I’ve tried Maven->Update Project, I’ve tried changing profiles using Maven->Select Maven Profiles.
I have my new binding almost ready (PCF8574 extender), but it is hard to test if if I can’t compile it
Here is the full log, I wasn’t able to post it here, because it was too long. openHAB_log.txt (138.6 KB)
there are couple of warnings while downloading dependencies and errors at the end:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openHAB Demo 2.5.0-SNAPSHOT:
[INFO]
[INFO] openHAB Demo … SUCCESS [ 9.864 s]
[INFO] openHAB Demp :: App … FAILURE [02:38 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:48 min
[INFO] Finished at: 2019-04-03T14:45:54+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project org.openhab.demo.app: Could not resolve dependencies for project org.openhab.demo:org.openhab.demo.app:jar:2.5.0-SNAPSHOT: The following artifacts could not be resolved: org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky-sources.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.leapmotion-LeapJava.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.plclogo-Moka7-1.0.2_io_patch.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.rfxcom-jd2xx.jar:jar:2.5.0-SNAPSHOT, org.openhab.bundles:org.openhab.binding.synopanalyzer:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-all-4.0.42.Final.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-javatellstick-1.1.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-netty-utils-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-dns-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-reactive-streams-1.0.8.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-reactive-streams-1.0.0.jar:jar:2.5.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT in openhab-artifactory-snapshot (JFrog) → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] DependencyResolutionException - Apache Maven - Apache Software Foundation
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :org.openhab.demo.app
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky-sources.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.leapmotion-LeapJava.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.plclogo-Moka7-1.0.2_io_patch.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.rfxcom-jd2xx.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.bundles:org.openhab.binding.synopanalyzer:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-javatellstick-1.1.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-netty-utils-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-dns-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-reactive-streams-1.0.8.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-reactive-streams-1.0.0.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openHAB Demo 2.5.0-SNAPSHOT:
[INFO]
[INFO] openHAB Demo … SUCCESS [ 0.672 s]
[INFO] openHAB Demp :: App … FAILURE [02:27 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:28 min
[INFO] Finished at: 2019-04-03T15:12:50+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project org.openhab.demo.app: Could not resolve dependencies for project org.openhab.demo:org.openhab.demo.app:jar:2.5.0-SNAPSHOT: The following artifacts could not be resolved: org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky-sources.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.leapmotion-LeapJava.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.plclogo-Moka7-1.0.2_io_patch.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.rfxcom-jd2xx.jar:jar:2.5.0-SNAPSHOT, org.openhab.bundles:org.openhab.binding.synopanalyzer:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-all-4.0.42.Final.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-javatellstick-1.1.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-netty-utils-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-dns-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-reactive-streams-1.0.8.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-reactive-streams-1.0.0.jar:jar:2.5.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT in openhab-artifactory-snapshot (JFrog) → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] DependencyResolutionException - Apache Maven - Apache Software Foundation
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :org.openhab.demo.app
It should be fixed by the addons by moving to Maven coordinates for its dependencies.
What you can do as a workaround is to add an exclusions element for the addons bom dependency of the demo that contains an exclude section for every artifact that you listed above.
Unfortunately that will not happen for the mentioned ones. Most jars have been eliminated, but the listed ones are not going in the near future because lack of time
A working demo repo for all the other working bundles would still be welcome.