Why use the SDK?
The SDK is the tool for setting multiple self-contained servers that can be run independently, at the same time by running each available server on a different port.
The SDK creates an independent Tomcat instance with its own database.
Prerequisite
Java 8 - Click to download
Maven - Click to download
MySQL - Click to download
Developing with the Reference Application
The steps are as follows.
Create a distribution server.
Select Reference Application version.
Connect with the database.
Running the server.
Step 1. Create a server by running:
Code Block | ||
---|---|---|
| ||
mvn openmrs-sdk:setup |
This will start the SDK in the wizard mode. When prompted, give a name to the server you're creating.
Next, you will be prompted to select the server type.
Code Block |
---|
You can setup the following servers: 1) Distribution 2) Platform Which one do you choose? [1/2]: |
Make a Distribution server by entering 1.
Step 2. Next, you'll be prompted to select the distribution version.
Code Block |
---|
You can deploy the following versions of distribution: 1) Reference Application 2.9-SNAPSHOT 2) Reference Application 2.8 3) Reference Application 2.6 4) Reference Application 2.5 5) Reference Application 2.4 6) Other... Which one do you choose? [1/2/3/4/5/6]: |
Step 3. Next, You will be asked what database you want to use:
Code Block |
---|
Which database would you like to use?: 1) MySQL 5.7 (requires pre-installed MySQL 5.7) 2) MySQL 5.7 in SDK docker container (requires pre-installed Docker) 3) Existing docker container (requires pre-installed Docker) |
Answer 1 here. The last prompt will ask you for the path to JDK:
Code Block |
---|
Which JDK would you like to use to run this server?: 1) JAVA_HOME (currently: /usr/lib/jvm/java-8-oracle/jre) 2) /usr/lib/jvm/java-7-oracle/jre 4) Other... |
If you have properly configured JAVA_HOME, answer '1'. If not, you need to answer with '4' and type path to JDK on your machine. Please note that OpenMRS platform 2.x requires JDK 8 to run.
Step 4. To run the server.
Code Block |
---|
mvn clean install openmrs-sdk:run -DserverId="server_name" |
This will start the server locally.