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 Way of Work document for DHIS 2 front end development.
- The documentation for the Web API which you can use to interact with the DHIS 2 system.
- Our Github repositories where you can find all of the web apps in DHIS 2.
- 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
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.