Deploying Services to Mule with maven-mule-plugin
November 15th 2010I’m still working on the Mule project that I mentioned in a previous post, and am using the new Mule Maven plugin, maven-mule-plugin to package a project for deployment in Mule. It works well for a simple Mule application, however, in my case, I’m providing the mule-config.xml in a jar file on which the project depends.
By default, the maven-mule-plugin looks for mule-config.xml in src/main/app. I’m using the maven-dependency-plugin’s unpack goal attached to the prepare-package phase to extract mule-config.xml from the jar dependency just before the package phase runs. This works, but presents one problem – I have to extract the xml file to the project’s source directory. This is unsatisfactory because it could easily lead to someone checking this file into the version control system – which I’d like to avoid.
I couldn’t find any documentation to this effect, but found by reading the source code to the maven-mule-plugin that the location of mule-config.xml can be configured. I added the following configuration to the plugin, and now have mule-config.xml extracted to the target directory.
<plugin> <groupId>org.mule.tools</groupId> <artifactId>maven-mule-plugin</artifactId> <version>1.2</version> <extensions>true</extensions> <configuration> <appDirectory>${basedir}/target/app</appDirectory> </configuration> </plugin>