Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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.

See the code for this example in action in the idgenws module: http://svn.openmrs.org/openmrs-modules/idgenws/trunk

Modify pom.xml files

Add a reference in the main pom.xml file:

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

Add a reference in the omod/pom.xml file:

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

Install the omod into your local repository

If the module are trying to include exists in the parent, you can skip this step

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

Failed to resolve artifact.

This happens because maven is unable to find the "idgen" jar in any public repository. We can get around this by either publishing to the openmrs maven repository (mavenrepo.openmrs.org) or by putting it in a local repo.

Installing omod to a local repo

The maven error output gives you a hint to out to install to a local repo. This script will download the omod/jar and install it for you using that line:

Shell 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.

Installing omod to openmrs maven repo

Open a new ITSM ticket in jira to request that your module be added.

Modify config.xml file

Add an element like this:

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