Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack


Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Spelling and grammar in some parts of the document


In order for Eclipse to format the code, you will need to import the OpenMRSFormatter.xml. This is file is located in the OpenMRS core, which you should clone if you haven't already.


Also check the two settings of "Number of (static) imports needed for *" and make sure the number is high enough for Eclipse not to replace your imports with the so called "star imports" using * because we do not want these. 99 is the default value for Eclipse and is usually high enough. 


From now on when you change a class and save it, Eclipse will format the code for you according to your formatter settings and organize the imports according to the import settings.

Show Print Margin

If you want to see whether your lines are longer than what you configured in the formatter you can let Eclipse show you a "Print Margin".


Add OpenMRS C
ode Templates

To save you some typing and so that you can focus on solving problems we put together a few code snippets/templates. Once you imported import them you can type short keywords and Eclipse context menu will suggest the appropriate template and once you select it, fill in the code with some variables for you to adjust the snippet to your use case.


See all templates available

We are not posting there their names here since the templates.xml should remain the single source of truth.

You can either use the Eclipse settings to see the templates you have or if you want to know the exact names of all snippets that you got from adding the OpenMRS templates execute


You might find yourself taking over the development of an existing module that others wrote and could use a little clean up. Lets Let us say it misses for example the @Override annotation in a lot of places. In such cases Eclipse can help automate this repetitive tasks.