ID: I202605121445
Status: idea
Tags: OpenMRS

creating an OpenMRS Maven plugin

I am basically just following this guide.

I assume that by this point you have already installed OpenMRS.

What you actually need to do

This is just the summarized part of Trying to figure it out but then without the mistakes and with the information I figured out in hindsight.

Trying to figure it out

I first did mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:setup-sdk in the folder where I wanted to create the plugin, and ran mvn openmrs-sdk:help to test it. That returned something like this:

... A lot more stuff ...

    serverId
      User property: serverId
      The identifier for the server to work with, if any

    stats (Default: false)
      User property: stats
      stats

    testMode (Default: false)
      User property: testMode
      test mode, if true disables interactive mode and uses batchAnswers, even
      if there is none


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.194 s
[INFO] Finished at: 2026-05-12T16:15:23+02:00
[INFO] ------------------------------------------------------------------------

Then I ran mvn openmrs-sdk:setup, this gave me a lot of questions:

Specify server id (-DserverId) (default: 'server')
# rotterdam
You can setup the following distributions:
# 2) Reference Application 3.x
Please choose a Reference Application 3.x version:
# 2) 3.6.0

Maar daarna had ik een error:

[INFO] [openmrs] Finished assembling frontend distribution
[INFO] npm not inheriting proxy config from Maven
[INFO] Running 'npm --legacy-peer-deps --cache=/tmp/openmrs-sdk-node217082876924472050/npm-cache exec -- openmrs@9.0.2 build --target /home/pye/openmrs/rotterdam/frontend --build-config /home/pye/openmrs/rotterdam/spa-build-config.json' in /home/pye/Documents/code/school/AvansModuleOpenMRS/pan-bahmni-plugin
[INFO] [openmrs] Running build process ...
[INFO] [openmrs] ModuleNotFoundError: Module not found: Error: Can't resolve '@react-aria/utils' in '/tmp/openmrs-sdk-node217082876924472050/npm-cache/_npx/2968b5eba1f26f22/node_modules/@openmrs/esm-styleguide/src/datepicker'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:27 min
[INFO] Finished at: 2026-05-12T16:23:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:6.8.0:setup (default-cli) on project standalone-pom: Failed to setup server: Unable to install spa with node: Unable to execute mojo: Failed to run task: 'npm --legacy-peer-deps --cache=/tmp/openmrs-sdk-node217082876924472050/npm-cache exec -- openmrs@9.0.2 build --target /home/pye/openmrs/rotterdam/frontend --build-config /home/pye/openmrs/rotterdam/spa-build-config.json' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[pye@archlinux pan-bahmni-plugin]$ 

so I tried fixing it with:

npm cache clean --force
mvn openmrs-sdk:setup

according to Claude, I should run the setup at home:

cd ~
mvn openmrs-sdk:setup

and then I remembered that I am dumb:

Van de SDK gaan jullie waarschijnlijk vooral ā€˜create-project’ gebruiken. ā€˜setup’ maakt een nieuwe server maar hoef je niet te gebruiken als je OpenMRS via Docker draait.

šŸ‘€

I navigated to this page in the wiki and ran mvn openmrs-sdk:create-project.

Options menu:

What kind of project would you like to create?:
# 1) Platform module
Please specify module id (default: 'basicexample'): 
# bahmni.appointment.forwarder
Please specify module name (default: 'Bahmni.appointment.forwarder'):
# Bahmni Appointment Forwarder
Describe your module in a few sentences (default: 'no description'):
# ...
Please specify initial version (default: '1.0.0-SNAPSHOT'):
# (left empty)
What is the lowest version of the platform (-Dplatform) you want to support? (default: '1.11.6'): 
# 2.7.6 (this is the version number I saw in the OpenMRS legacy UI panel)

References