Custom Module Development: Importing all dependencies from existing module and extending openmrs-distro.properties file

@ssmusoke, you can use a parent distro feature of SDK to inherit modules from another distro, which unfortunately hasn’t been documented on the wiki. Please see https://issues.openmrs.org/browse/SDK-185

Basically your base distro should publish a jar to maven containing openmrs-distro.properties on its root. Then you will be able to reference it in openmrs-distro.properties as distro.yourdistro=version

An example of a distro project is https://github.com/openmrs/openmrs-distro-platform

You should be able to import it in your openmrs-distro.properties as distro.platform=2.0.6

We use the same approach for referenceapplication, which you can import with distro.referenceapplication=2.7.0

Of course you can overwrite and add any modules to the one imported from the base distro.

Thanks @raff how would the syntax be for module based distro references such as org.openmrs.module:aijar:2.0.0

@raff is it possible to use my distro defined in the module openmrs-distro.properties file, https://github.com/METS-Programme/openmrs-module-aijar/blob/master/api/src/main/resources/openmrs-distro.properties, without having to create a distro project which will lead to duplication

Yes, it is. You need to deploy the module to the maven repo and then try:

distro.aijar-api=2.0.1-SNAPSHOT
distro.aijar-api.groupId=org.openmrs.module

@raff Thanks works like a charm, will update the documentation on the Wiki

@raff I am back with some strange behavior during the build process in this module https://github.com/ssmusoke/openmrs-module-ugandaemr-iss

  1. The module artifactId is ugandaemr-iss
  2. When I build the distro with this task https://github.com/ssmusoke/openmrs-module-ugandaemr-iss/blob/79ff6c7514423d00f5f5d482ce48e2d76762e994/omod/pom.xml#L51-L7
  • My module omod is changed and I see this in the message

    Copying ugandaemr-iss-omod-1.0.0-SNAPSHOT.jar to /Users/ssmusoke/openmrs/ugandaemr_iss/modules/ugandaemr-1.0.0-SNAPSHOT.omod

  • The distro message is

    Module 'ugandaemr' was updated to version '1.0.0-SNAPSHOT which is unrelated to my module name

Did you fix this?

@dkayiwa nope I am still stuck - can’t seem to find the root cause of stripping “-iss” from the file during copying

This looks like the culprit: https://github.com/openmrs/openmrs-sdk/blob/8c823b798f900728d3ffc9e4eb6eedd6b15daa61/maven-plugin/src/main/java/org/openmrs/maven/plugins/model/Artifact.java#L100

Thanks SDK-235 Enable artifact names to contain dashes by ssmusoke · Pull Request #148 · openmrs/openmrs-sdk · GitHub for review

Responded on github

I would like to go ahead and release OpenMRS SDK 1.13.1 - any objections?

None from me.

@dkayiwa The release ran well via Maven on my computer, but I am unable to deploy to Bintray

@pascal Please can you add me to the OpenMRS organization on BinTray https://bintray.com/openmrs

Did you take a look at this? https://ci.openmrs.org/browse/SDK-SDK/latest

@dkayiwa The CI was not working, which is why I ended up going to the old fashioned maven release process on my computer - everything seemed to be very slow today

Current error:

`[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project openmrs-sdk: Failed to deploy artifacts: Could not transfer artifact org.openmrs.maven:openmrs-sdk:pom:3.13.1 from/to bintray-sdk (https://api.bintray.com/maven/openmrs/maven/openmrs-sdk/;publish=1): Failed to transfer file: https://api.bintray.com/maven/openmrs/maven/openmrs-sdk/;publish=1/org/openmrs/maven/openmrs-sdk/3.13.1/openmrs-sdk-3.13.1.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]`

For some reason the release has been pushed to bintray - and it now works well

Was that supposed to fix the CI failure?

@dkayiwa I see the manual run on CI has worked for you… I wonder why not for me

I switched to Java 8

1 Like