Follow these instructions to get your system set up to do Buendia server development. See the Buendia wiki for more details about the app.
- If
java -version
does not report a version >= 1.7, install JDK 7:- Linux:
sudo apt-get install openjdk-7-jdk
- Mac OS: Download from Oracle
- Linux:
- Linux:
sudo apt-get install maven
- Mac OS:
- Visit https://maven.apache.org/download.cgi and download the Binary zip archive.
- Unzip the archive in your home directory.
- Add the
bin
subdirectory of the unpacked archive (e.g.$HOME/apache-maven-3.3.3/bin
) to your shell'sPATH
. - Confirm that the
mvn
command works by runningmvn -v
.
- Linux:
sudo apt-get install mysql-server
- Mac OS:
- Go to http://dev.mysql.com/downloads/mysql/ and download the DMG Archive for your Mac OS version.
- Open the downloaded file and then open the .pkg file within to install it.
- Open System Preferences > MySQL and click Start MySQL Server to bring the server up.
- Download the Community Edition at https://www.jetbrains.com/idea/download/ and follow the setup instructions.
-
Get the Buendia server source code:
git clone https://github.com/projectbuendia/buendia cd buendia
-
Set up a OpenMRS server configured to use MySQL and initialize the MySQL database with the "dev" site configuration:
tools/openmrs_setup dev
-
Build the Buendia module and set up an OpenMRS server with the module installed:
tools/openmrs_build
-
Start the server:
tools/openmrs_run
-
When you see the line:
[INFO] Started Jetty Server
the server is ready, and you can log in at [[http://localhost:9000/openmrs/]] as "buendia" with password "buendia".
After tools/openmrs_build
is done, your freshly built module will be an .omod
file in openmrs-project/server/openmrs/RELEASE/modules
. If you need to install it into an OpenMRS server running elsewhere, you can upload this file using the Administration > Manage Modules page.
-
In the "Welcome" dialog, click Import Project and select the
openmrs/pom.xml
file inside yourbuendia
repo. As you proceed through the import wizard:- Turn on Search for projects recursively and Import Maven projects automatically.
- On the "Select Maven projects to import" page, you only need the project named
org.projectbuendia:projectbuendia.openmrs
. You can deselect the others to reduce clutter.
-
After you click Finish, wait a few moments for IntelliJ IDEA to import the project. The projectbuendia.openmrs module should appear in the Project pane on the left.
You're all set!
Most of the interesting code resides in openmrs/omod/src/main/java/org/openmrs/projectbuendia/webservices.rest. You can make changes in IntelliJ IDEA and use the Build command to confirm that the module builds correctly.
When you want to test your module, use tools/openmrs_build
and tools/openmrs_run
from a Terminal within IntelliJ IDEA or any command shell. You can also do tools/openmrs_build -DskipTests
to build without running tests (use with care).
If you start the OpenMRS server from the shell with tools/openmrs_run
, it will run with remote debugging enabled so that you can debug the running server from within IntelliJ IDEA. To set this up:
-
Click Run > Edit Configurations...
-
Click the little plus button (+) in the top-left corner and select Remote.
-
Change "Unnamed" to something recognizable, then click OK.
Now when you click Run > Debug and use this configuration, IntelliJ IDEA will connect to the currently running OpenMRS server.