This article shows how to get Maven based Mule project to easily work within Eclipse without the need of constant redeployment to mule lib/user directory.

I will use “hello” sample project from Mule installation. contains modified “hello” Mule project
where I removed “.bat” file, commented out “version” tag in pom.xml to make maven build work, added dependency to vm and stream transports and put for easy access.

  1. Run “mvn eclipse:eclipse” on your project to create Eclipse project from it and go to “File->Import->GeneralExisting Projects into Workspace” to import it into Eclipse.
  2. Go-to Run->Run menu open “Run” dialog. It should look like this:

  3. Now we need to create a new Java Application configuration that will launch Mule. Right click on “Java Application” node and select “New” you should see this:

    • Type “mule-example-hello” in the “Name:” field.
    • For project click “Browse” and select the mule project you imported, in our case it will be “mule-example-hello”.
    • Type “org.mule.MuleServer” in “Main class:” field.
    • Check “Include libraries when searching for main class” and “Include inherited mains when searching for a main class”

    After all it should look like this:

  4. Select “Arguments” tab and type “-config ${resource_loc}” in “Program Arguments” field. Type “-Dlog4j.configuration=file:///${project_loc}” in “VM Arguments” field for Mule to find the log4j config file.
    This assumes that log4j config file is in the root of the project (you can change the path to your own log4j config location).

  5. Click “Close”.
  6. Now to run mule ESB with desired mule config file select the desired config file and click run button in the toolbar.
    To bypass the config file selection change the “Program arguments” to “-config ${project_loc}confhello-config.xml” to always run “hello-config.xml” configuration.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>