How to build kar files for marketplace that is compatible with milestone and SNAPSHOT builds

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="${project.version}" xmlns="">

	<feature name="openhab-binding-sony" description="Sony Binding" version="${project.version}">
		<bundle dependency="true">mvn:org.openhab.addons.bundles/${project.version}</bundle>
		<bundle start-level="80">mvn:org.openhab.addons.bundles/${project.version}</bundle>
  • Build kar file from my fork with mvn clean install -pl 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)?


Hi Andreas,

I am using a modified POM to build *.kar files for add-ons. Here are my changes:

Adding the above changes builds *.kar files automatically for all bundles when running the mvn clean install -T 1C command.

Do you like to try it? Feedback is welcome. If it is working for you we can push it to our repository.


1 Like

Hi Christoph,

Thanks for this apparently helpful link. I’m going to try it and will provide feedback shortly.


I’m happy to confirm that the kar file produced by your modified POM now works under a 3.2.0-SNAPSHOT and a 3.2.0.M3 runtime versions without issues. Some observations/notes:

  • I had to delete the repository element in the feature.xml (which I assume was the source of the issue)
  • The produced kar file has a smaller file size than the jar file (why?)

Thanks again for your quick response and the provided solution.

I cannot tell you why it is small. Maybe you want to extract both archives and compare their contents. This way we might get an idea of what is in there ant if it is correct to be there or what is missing.