Hot Deploy from Mule IDE

September 23 2010

2 comments
motif

The Mule does not natively support Mule 3’s new application structure yet, but not to worry, with the new 2.1 release of the Mule you can still keep it hot when working in the . Just follow a few simple steps and your apps will be doing the tango with Mule 3 while you code away in .

If you haven’t installed the Mule IDE, follow the instructions here to get up and running. Don’t forget to download and install Mule 3.

Before starting in Eclipse, create a new application directory in your Mule 3 installation called <Mule Home>/apps/<project name>. Create a subdirectory in it called classes. (For more on the application structure in Mule 3, go here)

Your Mule project will deploy to the output directory you specify when you created it. Eclipse defaults to <project name>/bin. To deploy to the Mule 3 application deployment directory, you need to set up a linked folder and then create source-specific output folders for the Java build path properties.

  1. Open the Java Build Path properties dialog in Eclipse and create a new default output folder under your project directory and call it “apps”. Create a linked folder underneath it that maps to the application directory you previously created.
  2. Make <Mule Home>/apps/<project name>/classes the default output folder

Your Build Path should now look something like this:

Build Properties Dialog

Build Properties Dialog

Almost there. Because of a bug in Eclipse, the Mule configuration cannot be deployed to the root application directory. We created the conf folder in our application directory as a workaround. This requires an application deployment descriptor to tell Mule where to look for your configuration (by convention Mule expects it in the root folder). Create a new file called mule-deploy.properties in your <Mule Home>/apps/<project name> directory and add the following:

config.resources=classes/mule-config.xml

Now just start up mule using the new application parameter:

<mule home>/bin/mule -app <project name>

Your application should start up. Now, anytime you rebuild in Eclipse, the project will reload automatically in Mule. You are hot deploying! Go ahead and try it by making a change to your mule configuration and watch it reload. Mule only monitors the configuration files today, so if you modify any of your class files or other dependencies, you will need to touch your configuration file for it to pick up the changes. If you have any problems or need to distribute additional third-party libraries with your application, I have posted more detailed instructions in the Mule IDE documentation.

Now that you have Mule 3 up and running in your IDE, go check out some of the other great new features available in Mule 3!


We'd love to hear your opinion on this post


2 Responses to “Hot Deploy from Mule IDE”

  1. There is a bug though when hot deploying an app and the app cannot be fully loaded due to a error in configs or something the jar file is still loaded.
    Then you cant remove the dir , and retouching the dir will not trigger a reload cause the app is not really loaded by mule.

    Deadlock YO

  2. Hi,

    It’s not really a deadlock. If the app is broken on startup, it won’t be monitored for changes, as there’s technically no app available. See the end of this doc http://www.mulesoft.org/documentation/display/MULE3USER/Application+Deployment . E.g. think of a WAR deployed to Tomcat for an analogy.

    We, however, plan to improve Mule 3 in the future to be able to monitor and pick up these broken apps as well when Mule is running in a dev mode (otherwise new broken apps will leak the memory).

    Having said that, I think the problem you’re observing is due to an app not shutting down correctly. I’ve seen it in some cases, e.g. when a thread terminates only on JVM shutdown and not on app disposal request. I would appreciate if you post more details and description of the problem in the user list/forum: http://forums.mulesoft.org/forum.jspa?forumID=102