Quick start

This section provides a quick guide to get up to speed with DHIS 2 development.

  • Download and install Java SDK 8, Bazaar and Maven.
  • If you intend to commit code to Launchpad you must register a user at Launchpad, then upload a SSH key pair and finally log in by invoking bzr lp-login <username> Identify yourself to Launchpad by invoking bzr whoami "Your Name <>" Also, you must be a member of a team with commit privileges to the particular branch, for trunk that is dhis2-devs-core.
  • Get a copy of the source code from Launchpad by invoking bzr branch lp:dhis2
  • To build the source code with Maven navigate to the /dhis-2 directory and invoke mvn install Then navigate to the /dhis-2/dhis-web directory and invoke mvn install again.
  • Each project in the /dhis-2/dhis-web directory is an individual web module. The dhis-web-portal project is an assembly of all the individual web modules. All of these modules can be started by invoking mvn jetty:run The web application can then be accessed at http://localhost:8080

Continuous integration

The DHIS 2 continuous integration server where you can find the latest builds of DHIS 2 artefacts can be found at

App development

To get started with DHIS 2 Web app development you can check out these resources.

  • The skeleton app which illustrates the structure and development frameworks which the DHIS 2 team uses.
  • The documentation for the Web API which you can use to interact with the DHIS 2 system.
  • The getting started with Apps documentation which explains the basics about apps.
  • Our Github repositories where you can find all of the Web apps in DHIS 2.

Knowledge base

This section contains learning resources for most development frameworks and tools used in DHIS 2. They are all open-source and pretty mainstream.

Subject Reference Slides Example code
Bazaar Reference
Maven 2 Reference Slides
Spring IOC container Reference Slides Example code
Spring AOP Reference Slides Example code
Spring Hibernate integration Reference Example code
Spring JDBC integration Reference Example code
Spring Transaction management Reference Example code
JUnit Reference Slides Example code
Hibernate Mapping Reference Slides Example code
Hibernate Queries Reference Slides Example code
Struts 2 Reference Slides Example code
Java Servlets Reference Slides

Collaboration platform

DHIS 2 uses Launchpad as its software collaboration platform. Launchpad provides bug and specification tracking, code hosting using Bazaar, mailing lists and more. To actively use Launchpad you need to register a user account by going to this page. If you have discovered a bug you can report it on the bugs page. If you want to request a feature or write a specification please do so on the blueprints page. To get an overview of the DHIS 2 source code branches please visit the source code page. The branch where the mainline development of the system takes place is called trunk. You can browse the latest checked in revisions and follow the latest registered bugs and blueprints in trunk on this page. You can browse the actual source code and its revisions in trunk on this page.

The mailing list for the DHIS 2 developer team is attached to the general developer team in Launchpad. This team is called dhis2-devs and is an open team, which means that everyone with a Launchpad account can be a member. First visit the team home page and sign up for the team. Then sign up for the mailing list by clicking the subscribe button under the mailing list heading. The address to post to is dhis2-devs at

Collaboration conventions

  • If you want to contribute to the development of DHIS 2 by implementing a piece of functionality you should create a separate source code branch. This branch will be used as basis for discussions of the solution and code peer review. When the functionality is implemented please send an email to the DHIS 2 developer list describing what you have done and request feedback.

    You could either create one branch for each piece of functionality or, if you are on a slow internet connection and only work on one piece of functionality at the time, create a generic branch and reuse it. To create and maintain a branch do the following:

    • Use a local unmodified trunk and branch locally with bzr branch <path-to-trunk> branch-name (you have to come up with the branch-name yourself, should be descriptive).
    • Navigate to branch directory and push to Launchpad with bzr push lp:~dhis2-devs-core/dhis2/branch-name This tells Launchpad that dhis2-devs-core is the owner, dhis2 is the project, and [branch-name] is the name of your branch. The branch will appear the branches page.
    • Set the commit destination for your branch with bzr bind lp:~dhis2-devs-core/dhis2/branch-name
    • Merge regularly with trunk in order to make it easier to integrate the solution in the end by doing bzr merge lp:dhis2

    A few rules apply when working with the source code branches:

    • Never use bzr push! Pushing will replace the content in trunk which means that the revision history will be lost. It is also prone to merging mistakes like overwriting other work in trunk.
    • Never use bzr uncommit! If you have made a mistake and want to fix it, then do bzr merge -r 100..90 (replace 100 and 90 with the revisions you want to remove) and commit as usual. Un-comitting will lead to problems as the lastest changes will be appear as diff in all existing working copies when they are updated.

    When its time to merge your branch with trunk, given that you have the required authority, please follow these steps:

    • Merge your branch with trunk with bzr merge lp:dhis2 and the commit as usual to your branch with bzr commit.
    • Navigate to a checkout of trunk and update it with bzr update.
    • Merge with bzr merge lp:~dhis2-devs-core/dhis2/<branch-name> (replace <branch-name> with the name of your branch).
    • Go through the changes with bzr status and bzr diff.
    • Commit your changes.
  • Before merging with trunk it's required to run all unit tests in the system. Be aware that you are working on a large system and that changes you do might conflict with other modules.
  • When committing code in response to a blueprint or bug, indicate that in your commit message by referring to title or number. Similarly, when marking a blueprint or bug as complete, indicate the revision number in a comment.
  • Follow the DHIS 2 code style and make sure your code looks like the rest (whether you like it or not).

Eclipse tips & tricks

Eclipse is the favoured IDE of the DHIS 2 development team. You can get it from here.

  • Import the DHIS 2 code style by downloading the profile from here. In Eclipse navigate to Window - Preferences - Java - Code Style - Formatter, then import the profile by clicking Import, locate your downloaded file and click Open. Then in Eclipse you can format your Java code with Shift-Ctrl-F.
  • DHIS 2 is built with Maven so installing the m2eclipse plugin is strongly recommended as it makes building and importing dependency libraries much simpler. Install from within Eclipse from Help -> Install New Software and use as update site.
  • To improve your coding environment navigate to Window - Preferences - General - Editors - Text Editors, then tick Show print margin and Show line numbers.
  • To change the text font navigate to Window - Preferences - General - Appearance - Colors and Fonts - Basic - Text Font - Edit.
  • To speed up building the source code by omitting the test phase invoke mvn clean install -DskipTests=true
  • A useful Eclipse plugin for Velocuty templates is Velocity Web Edit which can be downloaded here. A good plugin for XML files is XmlBuddy which can be downloaded here. Installation instructions for a useful plugin for Javascript files called JSEclipse can be found here. A good plugin for CSS files is CSS Editor which can be found here.

Netbeans tips & tricks

Netbeans is the favored IDE of some of the DHIS 2 development team. You can get it from here. One tricky aspect of using netbeans on dhis is to configure netbeans to deliver (approximately) the same code style as our eclipse comrades.

You can download a reasonably complete approximation of the DHIS style for netbeans from the link provided. Import it into netbeans using Tools->Options then look for the "Import" button at the bottom of the dialog. Just to be safe, you might want to export your current settings first, using the "Export" button in the same dialog. Please consider contributing any improvements to this set of style settings.

Intellij IDEA tips & tricks

Intellij IDEA is a nice IDE for Java development. You can get an approximate dhis code style from this link.

Maven tips & tricks

Maven is the build tool used by DHIS 2.

  • Run with no tests and no WAR file compression to reduce build time: mvn install -DskipTests=true -DuseWarCompression=false
  • Run a specific test to reduce test time: mvn test -Dtest=OrganisationUnitStoreTest

Web browsers

DHIS 2 can be used with all major browsers. For Internet Explorer version 11 or higher is recommended. For development purposes, Chrome is recommended due to its high performance and create developer console - click F12 to open it and use the Elements, Network and Console actively.