help getting my first module to work.

0 views
Skip to first unread message

Denise Draper

unread,
Jan 22, 2015, 2:10:03 AM1/22/15
to d...@openmrs.org
Hello all ---

I am trying to go through the simple "Creating your first Module" steps as described in https://wiki.openmrs.org/display/docs/Creating+Your+First+Module.  I have tried both the archetype route and the clone-and-edit route and had different difficulties with each.

I've spent the most time (and gotten the farthest) with the clone and edit process, so let me describe that issue:

I copied https://github.com/OpenMRS/openmrs-module-basicmodule and followed the editing instructions.
I didn't add any actual functionality to the module, I just wanted to go through the process to see it work.
I set OpenMRSVersion to 1.10.2-SNAPSHOT
The only thing I did that might have been nonstandard was delete the <scm> section of the pom.xml, since I don't actually have an scm at the moment.
Maven compile and package steps work with no errors.

However when I try to load the resulting omod file into my dev openMRS instance (which is a 1.10.2-SNAPSHOT version of openmrs-core only),
I get the following error:
Error while trying to start module
Module requires version matching . Current code version is 1.10.2

I've done some burrowing around in the code and discovered a few things that I think are relevant but I don't know enough about maven or j2ee to put the pieces together:
  1. Putting a breakpoint in org.openmrs.module.ModuleUtil.checkRequiredVersion shows me that the versionRange argument is empty: the omod is not specifying a version requirement.
  2. Comparing the contents of my omod file with other published omod files, I see that their config.xml files contain an element like this  <required_version>1.9</required_version>.  My config.xml does not have this line.
  3. The obvious candidate in the POM, the element <openMRSVersion>, does not have any impact on this, which I've tested in various ways.
  4. Simply adding a <required_version> tag to the POM.xml causes Maven to complain about a mis-configured POM.
How am I supposed to specify what version of openMRS my module is compatible with?  How is the <required_version> tag in the config.xml file generated?

BTW, when I tried to use the maven archetype to generate a sample module, I found that maven would have errors building it.  The same thing is true when I clone a copy of an existing published module off of github.  I get error messages such as this one (which I got trying to build the webservices module)
 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack-dependencies (Expand resources) on project webservices.rest-omod: Unknown archiver type: No such archiver: 'rest/omod-common/target/classes'. -> [Help 1]

So perhaps there is something wrong in my overall environment / maven configuration --- it might even be causing both problems.

Thanks in advance for any advice,

denise

Nick Fortescue

unread,
Jan 22, 2015, 5:30:26 AM1/22/15
to d...@openmrs.org
Hi Denise,

We have in our src/main/java/resources/config.xml the following line:
<require_version>${openMRSVersion}</require_version>
Not sure if that helps.


--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@openmrs.org.

Denise Draper

unread,
Jan 22, 2015, 7:02:32 AM1/22/15
to d...@openmrs.org
Why yes it does, thank you Nick!  I've been stuck on this for two days.
In my case the config file is in omod/src/main/resources/config.xml

I could have sworn I had looked for the string "require_version" in some of the existing modules, but I must not have, or maybe picked the wrong ones to check.
I notice that the maven archetype did generate that field in the code, but the github sample module does not have it --- maybe something that needs to be updated.

thanks!

denise

Denise Draper

unread,
Jan 22, 2015, 10:13:03 PM1/22/15
to d...@openmrs.org
Also, I have figured out the source of the error I encountered when trying to use the archetype.
It seems there is a known bug in maven when you have projects in which sub-projects depend on each other

I don't understand maven well enough to grok it all, but it seems that the problem only arises when you try to use maven for certain phases (in my case compile).  mvn package or mvn install work, without the error.

It seems like this would be a good thing to highlight somewhere in the documentation, since pretty much all openmrs modules have the structure that causes the problem, but I'm not sure where to put it.

denise

Daniel Kayiwa

unread,
Jan 23, 2015, 2:11:26 AM1/23/15
to dev

--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@openmrs.org.



--
If we keep uppermost in our minds the unkind and unjust acts of others, we shall find it impossible to love them as Christ has loved us; but if our thoughts dwell upon the wondrous love and pity of Christ for us, the same spirit will flow out to others.

Denise Draper

unread,
Jan 23, 2015, 1:53:05 PM1/23/15
to d...@openmrs.org
Done.
 
--
Denise Draper
 
Reply all
Reply to author
Forward
0 new messages