This section provides a quick guide to get up to speed with DHIS 2 development.
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 |
The developer documentation covers the technical architecture, the design of each module and use of the development frameworks behind DHIS 2. Feel like contributing to the documentation? Have a look at this document to get instructions on how to participate.
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 lists.launchpad.net.
Eclipse is the favoured IDE of the DHIS 2 development team. You can get it from here.
Firefox is the favoured browser of the DHIS 2 development team. You can get it from here.
The DHIS 2 user interface is fully internationalized and comes with a whole range of languages. If you are setting up DHIS 2 you might want to provide translations for the language of your country or improve the existing translations. To facilitate this process you might download and use the i18n resource editor. To start it simply unpack the archive and on Windows click the executable file, or on Linux invoke the startup script. Then browse to the root of the source code tree (dhis2/dhis-2), click OK and you are good to go.
DHIS 2 integrates with both JasperReports and BIRT.
DHIS 2 contains an embedded H2 database which will be used in-memory if no configuration is found. If you prefer to develop against a standard database we recommend that you use PostgreSQL which you can download here. Installation is pretty straight-forward, if you need guidance you can have a look at the excellent official tutorial. If you want to learn more you can consult the official documentation. Remember to let the user you want to connect with be the owner of the database. If you have problems connecting to the database on Linux you can consult this guide.
To configure the database connection you will need to create a configuration file called hibernate.properties. To tell DHIS 2 where to look for that file you will have to define an environment variable with the name DHIS2_HOME, pointing to the directory where you put the configuration file.
The contents of the hibernate.properties file would be something like this, where the database name is dhis2 and the user name and password are dhis.
If you are already committed to using MySQL you can download the latest version here. Documentation can be found here. The corresponding hibernate.properties looks like this.
DHIS 2 is packaged as a WAR-file and can be deployed to a Java Servlet container like Tomcat which you can download here. Deploying to Tomcat is a matter of placing the DHIS 2 WAR file inside the <installdir>/webapps directory and starting the container. The DHIS 2 portal is packaged as a WAR file by default and can found in the /dhis-2/dhis-web/dhis-portal/target directory. This guide explains how to start Tomcat, while everything else you need to know about Tomcat can be found here. Additional info on installing Tomcat on Linux can be found here.