DHIS 2 is open source software and the source code is hosted on Github. The core server-side code is found in the dhis2-core repository and the client-side apps are found in individual app repositories. If you would like to contribute, please fork our repositories and open a pull request.
This section provides a quick guide to get up to speed with DHIS 2 development.
- Download and install Java SDK 8, Git and Maven.
- Clone the source code from Github. The core source code repo is dhis2-core.
- 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 -U.
- 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
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.
This section contains learning resources for most development frameworks and tools used in DHIS 2. They are all open-source and pretty mainstream.
|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|
|Hibernate Mapping||Reference||Slides||Example code|
|Hibernate Queries||Reference||Slides||Example code|
|Struts 2||Reference||Slides||Example code|
DHIS 2 uses Launchpad as its software collaboration platform. Launchpad provides bug and specification tracking and mailing lists. 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.
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.
- 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 http://download.eclipse.org/technology/m2e/releases 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
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.
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
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 developer console. Click F12 to open it and use the Elements, Network and Console actively.