Setting up Mirth as Eclipse project



This is a mini-guide to setup Mirth as an eclipse project, in order to adapt some classes, build it from sources or explore the sources to learn how mirth is built. In fact, this is an enhanced version of my previous guide found in the wiki section of Mirth site. This new version has many screenshots of the configuration to provide an easier guide, and is adapted where needed to Mirth v1.8.1


Required software
To start the setup of eclipse project I’ll assume you have installed and configured:

You can install the appropiate version of subclipse from eclipse. You should go to Help item in eclipse menu, “Software Updates”, “Find and Install”:

“Search for new features to install”, and define a new repository location. Provide the appropiate URL to you eclipse version:


i.e.: http://subclipse.tigris.org/update_1.2.x. Check the appropiate update URL for your eclipse version at subclipse site. If you have some trouble at this point you can follow the installation guide from subclipse site. At the end of this process, eclipse should ask you about restart the application, answer yes.


Checkout the sources
When you have restarted eclipse with the subclipse plugin (if you don’t have it installed yet) follow this steps:

  • Create a New project, “Other”, “SVN”, “Checkout project from SVN”, and then “Next”:

  • Create a New repository location, Next
  • In the location URL, type: https://www.mirthproject.org/svn, Next
  • Now, a tree with the versions, tags … etc will appear. You should choose the version you are interested in. i.e if you want to build a customized version of 1.7.1 navigate to folder tags/1.7.1, and let the focus over 1.7.1 item.

    The “trunk” is the lastest version of all files code and -as Mirth developers are working on- it may not be able to compile or generate a valid instalator. You should avoid “trunk” unless you know exactly what are you doing.

  • While the focus is over the “1.8.1” item, click “Finish”
  • In the checkout dialog, check that “Check out as a project configured using the New Project Wizard” and “Head Revision” options are selected.
  • In the “New Project Wizard”, select Java/Java Project, and click “Next”.
  • You will be prompted about the project name, JDK to use in your environment … etc. Defaults are OK if you are using a 1.5.X JDK.
  • Click “Finish”, and go for a coffee while eclipse downloads the selected version of Mirth.

Now, you have a project in Eclipse with the sources of your favourite version of Mirth. What’s next?

Configuring the project in Eclipse

At this point, you should have a Java project with sub-folders: client, manager, server. Depending of the eclipse’s perspective you’re using, a “src” and “JRE systems libs”

  • Go to client, src. Right-click over “src” and “Build-Path”, “Use as Source Folder”.
  • You’ll get a “client/src” folder at the top of the project tree, marked with a red X. Don’t worry about this, and repeat this step with server/src and manager/src folders.

Now, you have the following folders: src client/src server/src manager/src client server manager JRE system lib

Many (or all) of them with a red X.

You can safely remove the “src” folder because it’s a Java project default unused by Mirth.

These red X are libraries referenced by Mirth that eclipse is unable to locate. It’s time to tell eclipse where can found them.

  • Right-click over the project, “Build Path”, “Configure Build Path”, and go to the tab “Libraries”.
  • Click the “Add jars” button, and select all jars included in client/lib/*, server/lib/* …. and so on (you must also select all jars under all subdirectories, including server/lib/mule/*, server/lib/jetty/*, etc).

Now, you should not have red X’s anymore, and the “Problems” tab at the bottom should not show Errors (only Warnings, if any), and a new Folder appeared at the top of the project tree, called “Referenced Libraries”.

Building Mirth from sources

  • Go to Run → External Tools → Open External Tools Dialog
  • Click in the “Ant Build”, right-click, “New”.
  • Name it Build Mirth.
  • Build file: browse the “server” folder, and select “mirth-build.xml”
  • Base directory: select the “server” folder

Test your ant task and if returning errors about can’t do some launch4j tasks, you must get the launch4j libraries from it’s official page and unzip them in (i.e.) c:\launch4j. Add the environment variable LAUNCH4J_HOME=c:\launch4j to the ant task you’ve defined above, and it should compile the whole project and generate the installers without problems.

The installers (for Unix, OS/X and Windows) should be under server/dist/ folder.

Running and Debugging Mirth from Eclipse

  • Run → Open Run Dialog
    • Java Application, right click, New.
    • Name it Mirth.
    • The main class is com.webreach.mirth.server.Mirth.
    • On the Classpath tab, select User Entries and click “Advanced…” button. Add Folders, OK. Select server/conf, OK. Click “Advanced…” again. Add External Folder, and browse to the server/extensions folder, and select it (not sure why it doesn’t show up under the Add Folders dialog).
    • On the Arguments tab, under Working Directory, select Other, click Workspace, and select the server folder.
  • Once defined, test that both Run and Debug works.

et voilà!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: