Mule ESB plugin for Maven

  • Written By WHISHWORKS
  • 17/07/2015

Introduction

The Mule ESB-maven-plugin is a separate plugin which is used to handle below things:

  • Start a standalone mule server [installs Mule as a service in Win32 machines]
  • Deploy domain
  • Deploy application(s)
  • Run unit tests (MUnit) from application(s)
  • Stop standalone mule server [uninstalls Mule service in Win32 machines]

This is much more powerful than running a traditional unit tests since we can run multiple applications at the same  time.

Prerequisites

The reader of this article is assumed to possess some basic knowledge of   Maven.

Detailed Steps

Add  the mule-esb-maven plugin to pom.xml file (Please note that it compiles the Java code in the project which is already existing)

<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>muleesb-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<muleHome>${mule.home}</muleHome>
<applications>
<!-- provide the zip file name for application1 to be deployed-->
<application>path-to zip file application1</application>
<!-- provide the zip file name for BS application2 to be deployed -->
<application> path-to zip file application2</application>Internal Use
</applications>
<!-- provide the zip file name for domain (if its used) -->
<domain> path-to zip file of application domain</domain>
<!-- Provide name of Groovy script which can do few utility tasks:
a) Example update conf/properties in standalone for the UTCs to run
b) Update /lib/user folder for shared libraries, etc
-->
<!-- <script>/home/mule/mvn/thisproject/script.groovy</script> -->
</configuration>
<executions>
<execution>
<id>deploy</id>
<!-- phase is deploy phase where Mule ESB is installed as a Windows
service and started -->
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<!-- phase is post integration test phase where Mule ESB is uninstalled
as a Windows service-->
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

2.  Add the dependent jar files to lib/user folder of mule standalone

Usage

1. mvn -X clean deploy post-integration-test -f xml -Dmule.home=”path –to-mule -standalone

2. mvn -X test surefire-report:report-only -Dtest=’UnitTestCase’ -DfailIfNoTests=false
-Dmule_home=path-to- mule-home -Dcredentials_vault_key=XXXXXXXX
-Djava.util.prefs.PreferencesFactory=com.mulesource.licm.pref.MulePreferencesFactory
-DESB_PROPERTY_FILE_PATH=path-to-property-files
-Dproject.version=${OUTPUT_VERSION}
-Dproject.artifactId=${SELECTED_SVN_PROJECT}

This command compiles the application code deploys the snippets to mule server by starting the mule server as a service and  runs the test cases. Surefire reports can also be generated using  this plugin using second command.

References

https://developer.mulesoft.com/docs/display/current/Mule+ESB+Plugin+For+Maven

If you would like to find out more about how Systems Integration could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at marketing@whishworks.com

Other useful links:

Integrate Mule ESB with Microsoft Office-365 SharePoint

Why should Retailers care about Systems Integration

MuleSoft in Retail

Latest Insights

Salesforce health cloud - healthcare
Blogs

Healthcare in the Cloud

Salesforce Health Cloud is designed to improve patient satisfaction, deliver high-quality patient care, and deliver positive outcomes.

Cloud API integration strategy
Blogs

Cloud API integration strategy – an introduction

It is simple, with the growing market of SaaS applications and cloud computing, point-to-point integrations with custom code are no longer good enough to provide seamless connectivity between these applications. […]

Data visualisation
Blogs

Data Visualisation 101

Data visualisation is a careful and thoughtful process of combining both data and visuals to convey the right message.