But if I try to deploy it to a remote server running DMX 5.1, the DMX plugin detection fails and I get an SEVERE:
java.lang.RuntimeException: DMX plugin detection failed for bundle ch.dreyeck.dmx-zettelkasten [34]
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle ch.dreyeck.dmx-zettelkasten [34]: Unable to resolve 34.0: missing requirement [34.0] osgi.wiring.package; (&(osgi.wiring.package=systems.dmx.core.osgi)(version>=5.2.0)(!(version>=6.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1832)
Do I have to recompile it with the DMX 5.1 release code branch instead of using upstream/master?
Yes, you would need to “backport” your plugin from 5.2. to 5.1 to run it on a 5.1 platform installation.
You can find all breaking platform changes documented in this ticket 341 on gitlab. Since DMX 5.1 was released (about six months ago) every note after this one addresses a change in between 5.1 and 5.2.
In this case, if you can wait, I would recommend you to do so. The 5.2 is to be released and it should be publicly available around next week, i guess.
If you compile a plugin against DMX 5.2 your plugin depends on the DMX 5.2 artifacts. A DMX 5.1 runtime environment on the other hand does not provide these dependencies, and plugin activation fails. OSGi’s semantic versioning applies here.
In case you want “downgrade” your plugin to 5.1: declaring the parent dependency (in your plugin’s pom.xml), and recompilation are the basic steps.
Recompilation should work immediately as the 5.1 platform artifacts are most likely still present in your local Maven repository. Otherwise install them with:
cd dmx-platform
git checkout 5.1
mvn clean install -P all
Hint: while DMX plugins are never backward compatible, in a lot of cases they are forward compatible though. That is installing a 5.1 plugin onto 5.2 platform possibly works. It depends on your plugin’s functionality.
Thanks Jörg @jri, just “downgraded” my plugin to 5.1 as described by you, saved my DMX 5.1 production environment (backup) and will continue with the update to 5.2.
Maybe related: To ease server updates and as such upgrading to newer DMX versions I use DMX through docker and docker-compose. The image source can be found here:
The image itself (container-registry.dmx.systems/dmx-contrib/dmx-docker/dmx-5.1:latest), so far has been built only for 5.1, but you can do the build on your own with the files above.