How to build a binding for 3.0.x?

I have been trying to build a binding and banging my head against the wall (repeatidly). I am trying to build for 3.0.x rather than the current state of main, which is now 3.1.x snapshot.

I tried based on “main” branch for openhab-distro and openhab-addons, and was successful at getting a build (once I had fought with line endings and spotless being a PITA), but that wouldn’t load on my 3.0.x device (raspberry pi 4) as it was getting a dependency error for osgi.framework. The device was running the stable release of OH3. I tried updating the device to the latest latest build, and that broke all the other bindings. I reverted the device back to the stable release.

I archived away my code, switched to the git branches for 3.0.x, fixed those up for spotless and am now trying to re-create a new binding that I can add my code back to. When calling the script to create the binding, I am getting an error that the archetype doesn’t exist:

C:\Users\sam.FUNNYFARM.000\OpenHab\openhab-main\git\openhab-addons\bundles>create_openhab_binding_skeleton.cmd HdmiCec "Sam Spencer" samsp99
[INFO] Scanning for projects...
[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://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] ---< org.openhab.addons.bundles:org.openhab.addons.reactor.bundles >----
[INFO] Building openHAB Add-ons :: Bundles 3.0.3-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[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://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] >>> maven-archetype-plugin:3.2.0:generate (default-cli) > generate-sources @ org.openhab.addons.reactor.bundles >>>
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java) @ org.openhab.addons.reactor.bundles ---
[INFO]
[INFO] --- directory-maven-plugin:0.3.1:directory-of (directories) @ org.openhab.addons.reactor.bundles ---
[INFO] Directory of org.openhab.addons:org.openhab.addons.reactor set to: C:\Users\sam.FUNNYFARM.000\OpenHab\openhab-main\git\openhab-addons
[INFO]
[INFO] --- spotless-maven-plugin:2.0.3:check (codestyle_check) @ org.openhab.addons.reactor.bundles ---
[INFO]
[INFO] <<< maven-archetype-plugin:3.2.0:generate (default-cli) < generate-sources @ org.openhab.addons.reactor.bundles <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.2.0:generate (default-cli) @ org.openhab.addons.reactor.bundles ---
[INFO] Generating project in Interactive mode
[WARNING] No archetype found in remote catalog. Defaulting to internal catalog
[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] The POM for org.openhab.core.tools.archetypes:org.openhab.core.tools.archetypes.binding:jar:3.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  24.906 s
[INFO] Finished at: 2021-04-24T19:05:58-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project org.openhab.addons.reactor.bundles: The desired archetype does not exist (org.openhab.core.tools.archetypes:org.openhab.core.tools.archetypes.binding:3.0.0-SNAPSHOT) -> [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/MojoFailureException
The system cannot find the path specified.
        0 file(s) copied.

How do I build for 3.0.x so that my device can be running the stable builds?

Also what should my .gitattributes look like on windows to just keep all line endings as LF so spotless doesn’t complain, and it doesn’t want to fixup the endings for all the other files dirtying the entire branch.

Thanks.

Have you checked this

Thanks, that solved it. Info added to docs with Adding a couple of flags and line ending info by samsp99 · Pull Request #1556 · openhab/openhab-docs · GitHub