Sunday, February 9, 2014

Skip to end of metadata
Go to start of metadata
Requirements

Checkout Source and Create Project

  1. File → New → Project → Checkout Maven Projects From SCM
  1. For SCM, choose 'svn' and browse to the project (http://svn.openmrs.org/openmrs/trunk)
  1. In older versions of the m2eclipse Eclipse plugin (prior to 0.11.0), you have an option to place all modules within a single project; this feature is deprecated as of m2eclipse 0.11.0.
    Click Advanced, and uncheck "separate projects for modules" (if that doesn't exist, change m2eclipse setting in Window → Preferences → Maven → Support multiple maven modules)
  2. Click Finish to download and create the Maven project(s).
Note: If you get the following error while trying to check out the code, switch the SVN URL from http to https. (i.e. https://svn.openmrs.org/openmrs/trunk)
checkout http://svn.openmrs.org/openmrs/trunk -r HEAD --depth=infinity --force
RA layer request failed
svn: REPORT of '/!svn/vcc/default': Could not read status line: connection was closed by server (http://svn.openmrs.org)

Develop with Maven

There are five projects shown in the workspace: openmrs, openmrs-api, openmrs-test, openmrs-tools, openmrs-web, and openmrs-webapp. The openmrs project is a parentproject. When we run any maven goal on the parent project, it will run the same goal on its children, according to the dependency order. A Maven menu item is added on the context menu, which lets you modify the pom.xml, manage dependencies and plugins, etc. Common maven goals are also added on the menu items Run As and Debug As. You can also create your own Maven Run Configurations.

How to run the build

  • Right click the openmrs project to bring up the context menu, select "Run as → Maven build..." (notice the "..." at the end)
  • Enter the Goals: clean install
  • Make sure the Maven Runtime at the bottom is correct for your installation (Configure for Embedded/External as necessary)
  • Select Apply, then Run
  • The build output will be displayed in the Console.
  • The output contains links to the results of each test.
To re-run the build, right click the root project to bring up the context menu, select "Run as -> Maven build."  If you have multiple configurations, select the "clean install" one to run.
To manage these configurations, right click the root project to bring up the context menu, select "Run as -> Run configurations...".  Select the configuration under the Maven Build section.

How to run Junit

If you want to run all tests across modules, select Openmrs project and right click to bring context menu, select "Run As → Maven test"
If you want to run all tests in one module, select that project and right click to bring context menu, select "Run As → Maven test"
If you want to run a single test class,right click on test class and select "Run As → Junit test"

How to Run Web Application

Create a run configuration by click "Run → Run Configurations", select Maven Build and click "New launch configuration", type Name "OpenMRS", select working directory to be the root of webapp project, type goal "jetty:run" and save. Now you select "OpenMRS" and run or debug it.
On the JRE tab, in the VM parameters box, you will want to put in your memory parameters, e.g.
-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:NewSize=128m
If on running, you get error messages including this: "java.net.BindException: Address already in use", most likely the default 8080 port is in use. You may want to change to any other different port for jetty. For instance if you want to change to port 8081, then on the JRE tab, in the VM parameters box, add something like this: -Djetty.port=8081
Jetty is currently configured to reload static resources like jsp, javascript files, etc. Changes to Java classes will require recompiling and restarting Jetty. (run maven:compile goal (if auto build is not enabled) and restart Jetty).

How to Profile Web Application with YourKit

Set up a run configuration as specified in "How to Run Web Application" but in the JRE tab, set the -agentpath VM option as specified in the YourKit docs. Common values:
  • Linux x86, 32-bit Java: -agentpath:/bin/linux-x86-32/libyjpagent.so
  • Mac OS X: -agentpath:/bin/mac/libyjpagent.jnilib
  • Windows, 32-bit Java: -agentpath:\bin\win32\yjpagent.dll
(This assumes you have YourKit installed already.)

How to Debug Web Application

Jetty plugin can pick up any changes of static resources, so changes of jsp, property or css files don't require a restart. However changes of java class will have to restart. The following solutions could help in some situations.

JVM Hotswap

Not yet documented.

Hot Deploy

Not yet documented.

Use JRebel

Here is how you configure JRebel to work with OpenMRS
  1. Download JRebel and install it. http://www.zeroturnaround.com/jrebel/current/
  2. Install JRebel plugin for Eclipse and restart.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel1.jpg
  3. Configure JRebel plugin for Eclipse.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel2.jpg
    Specify location of JRebel installation
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel3.jpg
Tick "Use Step filters" and also add com.zeroturnaround.* and org.zeroturnaround.* to the filters Tick "filter synthetic fields"
  1. Configure JRebel Agent Setting provided by JRebel installation
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel4.jpg
    Untick "Spring Framework Plugin"
  2. Change "OpenMRS" Run configuration to increase Permgen and enable JRebel.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel5.jpg
  3. Run or Debug "OpenMRS"
When you change any java classes, just wait for eclipse auto build to finish, reload the web page, and JRebel will reload the class for you.

5 comments:

oakleyses said...

louis vuitton handbags, oakley sunglasses, louboutin, longchamp outlet, nike shoes, louis vuitton outlet stores, chanel handbags, burberry outlet, prada outlet, jordan shoes, tiffany and co, michael kors outlet, tory burch outlet, louis vuitton outlet, longchamp handbags, nike free, true religion jeans, michael kors outlet, kate spade outlet, polo ralph lauren outlet, tiffany and co, prada handbags, polo ralph lauren outlet, michael kors outlet, michael kors outlet, longchamp handbags, oakley sunglasses, ray ban sunglasses, kate spade handbags, burberry outlet, louis vuitton outlet, louboutin outlet, louboutin, coach factory outlet, air max, air max, coach outlet, gucci outlet, christian louboutin shoes, michael kors outlet, coach purses, ray ban sunglasses, michael kors outlet, louis vuitton, coach outlet store online, true religion jeans, oakley sunglasses cheap

oakleyses said...

ralph lauren, lululemon, air max, hollister, north face, nike air max, polo lacoste, vanessa bruno, timberland, vans pas cher, louboutin, louis vuitton, oakley pas cher, air max pas cher, nike roshe run, air max, true religion outlet, barbour, sac longchamp, air force, hollister, sac louis vuitton, nike free, polo ralph lauren, nike trainers, louis vuitton uk, nike roshe, sac hermes, longchamp, michael kors, sac burberry, sac guess, mulberry, new balance pas cher, converse pas cher, sac louis vuitton, hogan outlet, nike tn, north face, true religion outlet, ray ban pas cher, michael kors, air jordan, nike blazer, nike free pas cher, michael kors pas cher, abercrombie and fitch, ray ban sunglasses

oakleyses said...

mac cosmetics, mont blanc, marc jacobs, canada goose outlet, nike huarache, vans shoes, soccer jerseys, hollister, giuseppe zanotti, beats by dre, abercrombie and fitch, longchamp, insanity workout, celine handbags, bottega veneta, ghd, nfl jerseys, north face outlet, chi flat iron, ugg boots, birkin bag, ugg australia, canada goose, herve leger, ugg pas cher, rolex watches, valentino shoes, canada goose uk, canada goose, ferragamo shoes, canada goose, ugg boots, uggs outlet, north face jackets, soccer shoes, asics running shoes, new balance shoes, p90x, lululemon outlet, canada goose jackets, mcm handbags, instyler, babyliss pro, ugg, wedding dresses, jimmy choo outlet, reebok outlet, nike roshe run

oakleyses said...

parajumpers, karen millen, air max, converse, pandora charms, moncler, louboutin, moncler, links of london, lancel, juicy couture outlet, oakley, hollister, pandora charms, supra shoes, thomas sabo, canada goose, gucci, wedding dresses, timberland boots, swarovski crystal, air max, coach outlet store online, moncler, ray ban, canada goose, moncler, ugg, louis vuitton, swarovski, hollister, montre homme, moncler, hollister clothing store, ralph lauren, rolex watches, moncler outlet, moncler, iphone 6 cases, baseball bats, juicy couture outlet, toms shoes, vans, pandora jewelry, ugg, converse shoes

Anna said...

Great and Useful Article.

Online Java Course

Java Online Training

Java Course Online

Best Recommended books for Spring framework

Java Interview Questions












Java Training Institutes in Chennai

Java Training in Chennai

J2EE Training in Chennai

java j2ee training institutes in chennai

Java Course in Chennai