Jetty standard flavored distribution for a standard database (PostgreSQL, MariaDB or MySQL)

Is it possible to build from sources a Jetty standard flavored distribution for a standard database (PostgreSQL, MariaDB or MySQL), i.e. distribution similar to the Jetty HSQLDB one: xwiki-platform-distribution-flavor-jetty-hsqldb-X.X.X-SNAPSHOT.zip? And if it is possible, how it could be done, any hints are greatly appreciated?

It’s definitely possible, but not sure it’s really needed. The jetty+hsqldb is not tied that much to hsqldb in practice: all you need to use it with another DB is to put the right connector JAR and modify hibernate.xfg.xml (which is something you will need to do anyway when you are not using an embedded database like hsqldb).

If you still want to build your own package (for example, when the hibernate configuration is always the same), I guess you have two main way:

  • copy the jetty+hsqldb module and modify any reference to hsqldb by the database you want
  • write a module which unpack and customize the jetty+hsqldb package and then package the result

On both cases, you will need to generate a hibernate.cfg.xml file with your own values (the default hibernate configuration is actually based on hsqldb). For that you can take inspiration from the Debian module which does exactly that (but package the generated hibernate.cfg.xml differently, of course), for example for MySQL see xwiki-platform/xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-mysql-common/pom.xml at master · xwiki/xwiki-platform · GitHub.

I would also recomment using org.xwiki.contrib:parent-distribution as parent.