We have a basic distro Maven project that basically just uses the maven-dependency-plugin to fetch a bunch of modules so that they’re ready to be copied into some target /modules directory (on our CI server or wherever else).
It would be nice for this build to also generate yet another output: an openmrs-distro.properties file that would allow to use the SDK with it to easily create a server for our distro.
Obviously this tool that generates such openmrs-distro.properties files already exists somewhere in the SDK, but how can we leverage on it within our own Maven project?
Can you turn around the problem and basically create openmrs-distro.properties manually where you declare versions and call openmrs-sdk:build-distro -Ddir=target instead of using maven-dependency-plugin? The modules will be fetched to the target/modules directory.
You can also configure the maven project itself to call build-distro for you as part of the build by adding this snippet to the build section in your pom:
Note I’ve tied it to the package phase, but it can be done earlier/later if need. Now each time you call mvn clean package, maven will run the build-distro goal for you.
Thanks @raff! The second option worked like a charm.
I made it work slightly differently since our distro is a lot simpler. I will post back when my changes are pushed (I was still just trying out locally).