Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typo is to in
Note

This tutorial expects you to be using a mavenized module layout.  See  Maven and  Converting old code to Maven to start if you are using an old ant/build.xml based module.

...

If your API layer requires a reference to the module, add a reference to the api/pom.xml file:

Code Block

<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>idgen</artifactId>
  <version>2.0.1</version>
  <type>jar</type>
  <scope>provided</scope>
</dependency>

If your web layer requires a reference to the module, add a reference in the omod/pom.xml file:

Code Block

<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>idgen</artifactId>
  <version>2.0.1</version>
  <type>jar</type>
  <scope>provided</scope>
</dependency>
Note

It is important to make sure you set the parameter <scope>provided</scope> so that the jar of the referenced module is not included is in this module's omod.

Install the omod into your local repository

...

When running "mvn package" you will probably see an error like:

Code Block

Failed to resolve artifact.

...

Code Block
titleShell script for downloading a PRE-maven module and including it

#!/bin/sh
moduleid="idgen"
version="2.0.1"
wget https://modules.openmrs.org/modules/download/$moduleid/$moduleid-$version.omod
mv $moduleid-$version.omod $moduleid-$version.jar
mvn install:install-file -DgroupId=org.openmrs.module -DartifactId=$moduleid -Dversion=$version -Dpackaging=jar -Dfile=$moduleid-$version.jar

If the module you want to include is mavenized, get BOTH the api and omod jars from the target folders and "mvn install" them.
In that case, the omod renaming goes like this:

Code Block

mv $moduleid-$version.omod $moduleid-omod-$version.jar

...

Add an element like this:

Code Block

<require_modules>
  <require_module version="2.0.1">org.openmrs.module.idgen</require_module>
</require_modules>