Skip to content

Clone Build and Run from Source

Chris Turczynskyj edited this page Nov 3, 2021 · 6 revisions

This document describes how to build and run Mirth Connect from its source.

Getting and Loading the Mirth Connect Source

Clone the Mirth Connect GitHub repository:

git clone https://github.com/nextgenhealthcare/connect.git

Git Clone

Create a local branch from development for your changes (SourceTree application shown in images).

Create Local Branch

Import the Mirth Connect projects into Eclipse

Download and install Eclipse.

  • In Eclipse, File > Import > General > Existing Project into Workspace.

Eclipse Import

  • Choose the root folder containing the git repo. This will contain subfolders for client, donkey, server, etc.

Eclipse Import

Select the main projects:

  • Client
  • Command
  • Donkey
  • Manager
  • Server
  • Webadmin

Eclipse Import

Click "Finish"

You now have Mirth Connect's source code loaded into Eclipse.

Building Mirth Connect

Mirth Connect uses Apache Ant for its build. In the Eclipse Menu show the Ant view:

  • Window > Show View > Ant

Eclipse Import

The build file mirth-build.xml will build:

  • CLI
  • Client
  • Donkey
  • Extensions (Server and Custom)
  • Manager
  • Server
  • WebAdmin

Load the Mirth Connect build file:

  • Drag Server/mirth-build.xml into the Ant view.

Add ANT Build

Ensure ANT is configured to use Java 1.8.

Configure ANT Build

Configure ANT Build

Click Apply

Note: If you need to build with another Java version (for example OpenJDK9), at the moment, you will need to edit the build.xml file and follow the instructions in the comments surrounded by "<!-- Uncomment the following and ... -->". There are several places in the build.xml file where this needs to be performed.

Start a build of Mirth Connect:

  • Double click "build [default]"

The full build will take some time, so the next section will detail how to make a good Bolognese sauce from scratch while you wait (kidding).

Once you see the glorious words "BUILD SUCCESSFUL" your build is complete.

Server Build Complete

You may need to refresh the projects in the Package Explorer to get it to recognize the build changes and remove any errors it sees.

Running Mirth Connect from IDE

Starting Mirth Connect Server

The Mirth Connect project includes run configurations so the first thing to do is load Mirth Connect's Run Configurations:

  • Eclipse menu > Run > Run Configurations...

Run Configurations

Expand the Java Application section and you will see several Mirth Connect configurations:

Run Configurations Server

  • Start with "Mirth Connect Server"

Here you can change the configuration like Java arguments and what JRE to use. Mirth Connect should just work with Java 1.8. However, if you need to use a different Java version (ex: OpenJDK9) then you will need to provide extra VM arguments. The list of arguments is located in the file mcservice-java9+.vmoptions:

  • server/docs/mcservice-java9+.vmoptions

Click "Run"

The first time the Server project runs it will create an appdata directory when Mirth Connect Server doesn't see one.

You should see the following if it was able to successfully start Mirth Connect Server:

ERROR 2020-04-29 16:27:29,327 [main] com.mirth.connect.server.extprops.ExtensionStatuses: Unable to find appdata directory: appdata
INFO  2020-04-29 16:27:48,474 [Main Server Thread] com.mirth.connect.server.Mirth: Mirth Connect 3.9.0 (Built on April 29, 2020) server successfully started.
INFO  2020-04-29 16:27:48,477 [Main Server Thread] com.mirth.connect.server.Mirth: This product was developed by NextGen Healthcare (https://www.nextgen.com) and its contributors (c)2005-2020.
INFO  2020-04-29 16:27:48,478 [Main Server Thread] com.mirth.connect.server.Mirth: Running Java HotSpot(TM) 64-Bit Server VM 1.8.0_241 on Mac OS X (10.14.6, x86_64), derby, with charset UTF-8.
INFO  2020-04-29 16:27:48,480 [Main Server Thread] com.mirth.connect.server.Mirth: Web server running at https://192.168.1.31:8080/ and https://192.168.1.31:8443/

Starting Mirth Connect Client

Again, go to Run Configurations and this time select Mirth Connect Client.

Run Configurations Client

Configure it as necessary then click "Run".

If all goes well, you should see the Mirth Connect Administrator.

Client Run Success

Note, IDE builds of Mirth Connect are self-signed. This means the Mirth Connect Administrator Launcher will not be able to validate the chain of trust and, thus, will not launch the client without you taking extra measures like 1) signing your Mirth Connect Jars with a trusted certificate (recommended) or 2) if you are just testing for development, forcing the Mirth Connect Administrator Launcher to allow Jars signed with a self-signed certificate (the -k option).

Contribute Your Changes

After you've made your changes and you want to contribute them back to the open source project, you will need to commit and push your local branch to remote.

Commit and Push Local Branch

Lastly, create your pull request in GitHub to merge your branch into development.

Clone this wiki locally