Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A module can only access the api/service of another module if it is marked as required.  The classloaders restrict this.  The reasoning is both to make classloading faster and to prevent classloading errors if the other module does not exist in a running openmrs.

...

  • The "version" attribute on the require_module element is available as of OpenMRS v1.5.
  • You probably want to then take the other module's .omod file, put it in your module's lib-common folder, and add it as a library in your eclipse project's build path(Add it to the .classpath of your module and also add to your build.xml <include name="*/.omod"/> to the <fileset dir="lib-common"> tab and ant should be able to see it too.
  • The "require_modules" element must be after "require_version" and before "extension" in the config.xml file

With this example, if at least formentry version 1.8 is not installed, then this module will not start. 

...

If you have a mavenized module:

  1. In your module's root pom.xml you need something like this:

    Code Block
    <dependencyManagement>
    	<dependencies>
    		<!-- Depends on ZZZ module -->
    		<dependency>
    			<groupId>org.openmrs.module</groupId>
    			<artifactId>themoduleid-api</artifactId>
    			<version>1.0</version>
    			<type>jar</type>
    			<scope>provided</scope>
    		</dependency>
    		...
    	</dependencies>
    </dependencyManagement>
    


  2. In your module's omod/pom.xml you need something like this:

    Code Block
    <dependency>
    	<groupId>org.openmrs.module</groupId>
    	<artifactId>themoduleid-api</artifactId>
    </dependency>
    


...

  • The "aware_of_modules" element must be between "require_version" and "extension" in the config.xml file