I’ve started to deploy the Sony Binding via the community marketplace. To avoid the need to manually install features, I’ve decided to provide a kar file with all necessary feature dependencies. The build process for this kar file is as follows:
- Use recent 3.2.0-SNAPSHOT addons codebase
- Define
feature.xml
with all dependencies
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.sony-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
<feature name="openhab-binding-sony" description="Sony Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-upnp</feature>
<bundle dependency="true">mvn:org.openhab.addons.bundles/org.openhab.transform.map/${project.version}</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.sony/${project.version}</bundle>
</feature>
</features>
- Build kar file from my fork with
mvn clean install -pl :org.openhab.binding.sony karaf:kar
The generated kar file can be installed from the community marketplace from a recent 3.2.0-SNAPSHOT runtime environment (build #2549) without any issues. However, when I try to install the same kar file using the 3.2.0.M3 runtime environment, the following error is thrown:
java.lang.RuntimeException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT] : mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/3.2.0-SNAPSHOT/xml/features
My guess is that this is caused by the definition of the repository in the feature.xml
file where ohc.version=3.2.0-SNAPSHOT
. I’ve tried to set the variable `ohc.version=3.2.0.M3’ in the maven command, but this fails as this repository is not found. Also omitting the repository results in a build failure.
So my (slightly more general) question is: Is there any possibility to build a kar file that is compatible with multiple OH runtime versions (e.g. milestones and SNAPSHOT builds). If yes, how could that be achieved (by a proper feature.xml or other options)?