Fell at the first!

Hi Guys,
Hopefully this is an easy one, am I missing something?
I have a RPi4 set up and running openHAB2, using the openHABian distribution all working a treat. This is the final platform so I decided that binding development should not happen on that device.

I was looking at picking up the Roku binding as I have 3 NOW TV boxes that all run the Roku control protocol. First task was to get the environment running but I decided to build a new binding skeleton rather than just go for the code that was abandoned some time ago.

So on a Win7 machine I installed Oracle JDK 8 and the Apache Maven 3.x. Paths have been set as below:

openHAB2 installed okay and is running

echo %PATH%
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Lenovo\Touch Fingerprint Software\;C:\Program Files
 (x86)\Lenovo\Access Connections\;C:\Program Files (x86)\Common Files\Lenovo;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\PuTTY\;C:\Program Files\SDCC\bin;C:\Program Files (x86)\GnuWin32\bin;C:\apache-maven-3.6.3\bin

echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_251

BTW. I think there is an error in the docs as it relates to %JAVA% which I think should be %JAVA_HOME%

I follow the instructions to create the skeleton, although it is unclear what the root should be, but I assume it is C:\Users<username>\openhab-2-5-x\git\ as it is the only place I can find openhab-addons/bundles.

create_openhab_binding_skeleton.cmd MyNewBinding “” generates errors and warnings.

create_openhab_binding_skeleton.cmd roku "Mark Spavin" spavinm
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://jcen
ter.bintray.com was cached in the local repository, resolution will not be reattempted until the update interval of jcenter has elapsed or updates are forced

[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://jcenter.bintray.com was cached in the local repository, resolution will not be reattempted until the update interval of jcenter has elapsed or updates are forced

[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.

[WARNING] Don't override file C:\Users\Mark\openhab-2-5-x\git\openhab-addons\bundles\org.openhab.binding.roku\pom.xml

[INFO] Project created from Archetype in dir: C:\Users\Mark\openhab-2-5-x\git\openhab-addons\bundles\org.openhab.binding.roku
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.322 s
[INFO] Finished at: 2020-05-14T23:03:40+01:00
[INFO] ------------------------------------------------------------------------
        1 file(s) copied.

Method invocation failed because [System.Object[]] doesn't contain a method named 'replace'.
At line:1 char:97
+ (Get-Content org.openhab.binding.$env:BindingIdInLowerCase/src/main/feature/feature.xml).replace <<<< ('-core/${project.version}'
, '-core/${ohc.version}') | Set-Content org.openhab.binding.$env:BindingIdInLowerCase/src/main/feature/feature.xml
    + CategoryInfo          : InvalidOperation: (replace:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

I have uninstalled, checked reinstalled but always the same error. However the binding folder does seem to be there, so I attempted the second step from the addons root.

mvn clean install -pl :org.openhab.binding.roku
[INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: :org.openhab.binding.roku @
[ERROR] Could not find the selected project in the reactor: :org.openhab.binding.roku -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException 

I am not familiar with the Maven environment, but thought I would learn “on the job” so to speak. Even with the detailed trace the error do not make any sense at all as yet.

I can see plenty of folks have been building bindings, has anyone any info that may get me rolling?

Sorry its a long post
Cheers
Mark

What IDE are you using? Generally (I think) the IDEs downloads and caches all maven dependencies when the project is loaded, do you see any errors there? I guess this can also be done manually from the command line, but I don’t know what maven commands need to be run. Anyway, it might be required for the create skeleton script to be run properly.

Someone more versed in this might have a better answer, but let’s start there.

Also, your post is easier to read if you use code fences around your command line output:
```
Your text here
```
Makes it look like this:

Your text here

Hi Anders,
Thanks for the response. I have tidied up the original post as you suggested, thanks for the tip.

This is all carried out before I have even loaded eclipse IDE. But I have already installed eclipse and loaded the openHAB add-on development projects and have a git folder with then in. I have followed the development guide from here https://www.openhab.org/docs/developer/#develop-a-new-binding, the last line is “Open Eclipse…” so the command line stuff is all before you get to the IDE. I can see the new folder structure after these commands, but the build still fails.

I’m sure it will be something I have missed or not understood but after a whole day on this I am still not seeing what the problem is.

Thanks again

Have you followed the instructions here: https://www.openhab.org/docs/developer/ide/eclipse.html as well?

Including

Attention

It is important , during the first Eclipse IDE launch, to leave Eclipse open until all openHAB related initial Setup tasks / Download sources / Builds are completed.

Did you get any errors there? I sometimes get errors like yours when starting my IDE (intellij), when maven is syncing the dependencies, but not sure what they mean exactly. It might just be a temporary communication issue, and working fine the next time.

Sorry I can’t help you more, I’m rather new at this as well.

Good shout I will uninstall the Eclipse and try that again and make sure it finishes, I am fairly sure it has last time it was installed.

Thanks

There might be some problem with the create script on Windows. In your log it gives an error. Which suggests a patch in the script to modify the genereated feature.xml doesn’t work. Also I’ve seen reports it doesn’t add the newly generated binding to the bundles/pom.xml. You might need to add it manually to that pom.xml file.

Thanks Hilbrand, I have found that one, I have not found a workaround, the MS docs say that single quotes should not expand the ${variable}, this doesn’t seem to work. There is also a lifecycle reference that fails, but the folders are in a mess now, so I need to clean up before going any further.