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 make classloading faster and to prevent classloading errors if the other module does not exist in a running openmrs.
To denote that the module you are writing depends on, or requires another one, put something like the following in your config.xml file:
With this example, if at least formentry version 1.8 is not installed, then this module will not start.
This feature is available starting from OpenMRS v1.9
There are times when you need to be able to make a module aware of other modules, without requiring them. This means that if the other module is also installed, do some extra features.
A specific example: The dev of formimportexport module wants his module to be able to be installed without requiring the user to install the formentry module as well. However, formimportexport has some extra stuff to do to forms if formentry is installed, so it needs to call formentry's API optionally.
Formimportexport should be aware of formentry, be compiled against formentry.jar, and be able to say something like:
To denote that the module you are writing is aware of another one, put something like the following in your config.xml file:
If you have a mavenized module:
If your module is NOT using maven: