Building the Raxacore Module and Adding it to OpenMRS

Building with the latest Stable Version of the Rest Web Services Module
Building the OMOD files
  1. Download a clone of the raxacore repository from Github (https://github.com/Raxa/raxacore) (If you want to work on the raxacore module, create a fork first and then download a clone of your fork. See https://help.github.com/articles/fork-a-repo for details on how to do it)
  2. Install an IDE like Netbeans
  3. Right click on the project name (RaxaEMR Core) and click on Clean.
  4. Then right click on the project name again and this time click on Build with Dependencies.
  5. Wait for the project to build. On completion, you would have successfully built the omod file required (sometimes can take 10 minutes or more the first build)
Adding the module to OpenMRS
  1. Setup an instance of OpenMRS on your localhost. (For details on how to do it, simply download the OpenMRS standalone or check Getting Started Guide: Back-end Development)
  2. Log-in to your OpenMRS instance. (the url is usually http://localhost:8080/openmrs/)
  3. Click on the Administration tab.
  4. Click on Manage Modules.
  5. Click on Add or Upgrade Module.
  6. Under Add Module, go to the Search box and type in "Rest Web Services" (without the quotes).
  7. Click on Install next to the Rest Web Services module that shows up in the list. (Double check that this version is the same as the one you entered in the dependency attribute. Ignore the numbers after the last dot)
  8. Wait a few seconds for the Module to be added and then started.
  9. After this, click on Add or Upgrade Module again.
  10. Under Add Module, select Choose File and this time, browse to the folder where you have your local clone of raxacore. Open the omod folder and then the target folder and then select the .omod file (Eg: raxacore-0.1-SNAPSHOT.omod)
  11. Wait for a few seconds for the Module to be added and then started.
  12. If you can see Rest Web Services and RaxaEMR Core listed in the Manage Modules list, you have successfully installed the Raxacore module in OpenMRS.

 

=======================

Building with the latest SNAPSHOT (development) Version of the Rest Web Services Module
Building the OMOD files
  1. Download a clone of the raxacore repository from Github (https://github.com/Raxa/raxacore) (If you want to work on the raxacore module, create a fork first and then download a clone of your fork. See https://help.github.com/articles/fork-a-repo for details on how to do it)
  2. Install an IDE like Netbeans or Eclipse.
  3. Open the raxacore project folder (the folder you just cloned) as a project in the IDE.
  4. The raxacore project requires the webservices.rest module as a dependency. You need to download that module.
  5. To download that you need to have an SVN client installed (or you can use your IDE to create a Project by SVN Checkout). If you want to download an SVN client, TortoiseSVN (http://tortoisesvn.net/downloads.html) is a good option for Windows or you can try the SVN client from Apache (http://subversion.apache.org/packages.html)
  6. SVN Checkout the webservices.rest module from the OpenMRS repository (http://svn.openmrs.org/openmrs-modules/webservices.rest/trunk/)
  7. In the IDE, open the project that you just checked out.
  8. Right click on the project name (Rest Web Services) in the project explorer and build with dependencies.
  9. Check the pom.xml file under the project files and note the value of the Version attribute. (At the time of this writing the Version was 1.1-SNAPSHOT)
  10. Now, open the pom.xml file of the raxacore project and scroll down to the comment <!--webservices.rest main module–>
  11. Below this, check the value for version for the 3 dependencies included. If it is something other than what you saw in step 9, change this value to that.
  12. After this, right click on the project name (RaxaEMR Core) and click on Clean.
  13. Then right click on the project name again and this time click on Build with Dependencies.
  14. Wait for the project to build. On completion, you would have successfully built the omod files required.
Adding the module to OpenMRS
  1. Setup an instance of OpenMRS on your localhost. (For details on how to do it, check Getting Started Guide: Back-end Development)
  2. Log-in to your OpenMRS instance. (the url is usually http://localhost:8080/openmrs/)
  3. Click on the Administration tab.
  4. Click on Manage Modules.
  5. Click on Add or Upgrade Module.
  6. Under Add Module, select Choose File and browse to the folder where you checked out the webservice.rest module. Follow the path /omod/target and then select the .omod file (Eg: webservices.rest-1.1-SNAPSHOT.28209.omod). Select that file, and then click on Upload.
  7. Wait a few seconds for the Module to be added and then started.
  8. After this, click on Add or Upgrade Module again.
  9. Under Add Module, select Choose File and this time, browse to the folder where you have your local clone of raxacore. Open the omod folder and then the target folder and then select the .omod file (Eg: raxacore-0.1-SNAPSHOT.omod)
  10. Wait for a few seconds for the Module to be added and then started.
  11. If you can see Rest Web Services and RaxaEMR Core listed in the Manage Modules list, you have successfully installed the Raxacore module in OpenMRS.
Possible Issues Faced
  1. While building Raxacore, you could face errors like:
    1. Could not resolve dependencies for project org.raxa.module:raxacore-omod:jar:0.1-SNAPSHOT: Failure to find org.openmrs.module:webservices.rest-omod:jar:tests:1.0-SNAPSHOT in http://mavenrepo.openmrs.org/nexus/content/repositories/public was cached in the local repository, resolution will not be reattempted until the update interval of openmrs-repo has elapsed or updates are forced
    2. Failed to resolve artifact.
    3. reference missing in pom.xml
    All such problems are due to a dependency resolution failure of the webservices.rest module. To solve this, you need to ensure that you followed the steps mentioned above in the proper order. Also, ensure that the version of webservices.rest module in your pom.xml file for raxacore matches the version that you built from the SVN checkout of the OpenMRS Repository. If some error like this still persists, you can try manually adding the api, omod, javadoc, test and sources .jar files. However, this step is not recommended at all.
    If you are still finding missing .jar files, or your .jar files are out of date, try closing out of NetBeans and reopening.
  2. Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project raxacore-api: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.10 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 (): Failed to read artifact descriptor for org.apache.maven:maven-artifact:jar:2.0.9: Could not transfer artifact org.apache.maven:maven-artifact:pom:2.0.9 from/to openmrs-repo (http://mavenrepo.openmrs.org/nexus/content/repositories/public): mavenrepo.openmrs.org: Unknown hostmavenrepo.openmrs.org -> [Help 1]
    1. Run maven with -DskipTests=true clean install
    2. Use Clean, Build with Dependencies
  3. If you are have trouble building with the version of REST already in raxacore:
    1. Open your web browser and check the pages https://modules.openmrs.org/modules/view.jsp?module=webservices.rest and http://mavenrepo.openmrs.org/nexus/content/groups/public/org/openmrs/module/webservices.rest/
    2. From these pages, check the version number of the latest release of the Rest Web Services Module . (At the time of this writing the Version was 1.0)
    3. Now, open your IDE and open the raxacore project folder (the folder you just cloned) as a project.
    4. Open the pom.xml file of the raxacore project and scroll down to the comment <!--webservices.rest main module–>
    5. Below this, check the value for version for the 3 dependencies included. If it is something other than what you saw in step 4, change this value to that.

Other Issues

For other issues, here are some links,

GIT - https://help.github.com/

SVN - http://tortoisesvn.net/faq.html

Apache Tomcat (if using this instead of Jetty) - http://tomcat.apache.org/download-70.cgi (For Windows, Install the 32-bit/64-bit Windows Service Installer)

Jetty - http://docs.codehaus.org/display/JETTY/Quick+Start

MySQL - http://www.mysql.com/downloads/mysql/

Installing OpenMRS -  Getting Started Guide: Back-end Development