DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • MuleSoft: Do You Have an Extra Mule Under the Hood?
  • MuleSoft: Tactical and Strategical Role of an Application Template

Trending

  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  • Is Agile Right for Every Project? When To Use It and When To Avoid It
  • The Human Side of Logs: What Unstructured Data Is Trying to Tell You
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. How to Import a MuleSoft Application as a Utility or Reference

How to Import a MuleSoft Application as a Utility or Reference

Learn how to plug an already-developed MuleSoft application into your underdeveloped application in just five easy steps.

By 
Satwinder Singh user avatar
Satwinder Singh
·
Feb. 18, 19 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
25.6K Views

Join the DZone community and get the full member experience.

Join For Free

While exploring Mule 4, I was reminded of the old webMethods days, which provided you the freedom to include your common utility applications/interfaces into your main applications. Not only did it help to reduce code duplication, but it also helped speed up your development cycle.

As some of you may know, we can achieve this in MuleSoft as well. Let's quickly demonstrate how you can plug an already-developed MuleSoft application into your underdeveloped application. 

Step 1: Create a MuleSoft application containing common logic that can be used in multiple applications (e.g. calculate interest, enrichment, cross-referencing, etc.).

Step 2: Export the utility application as JAR file from Anypoint Studio along with its pom.xml in same folder location (in Mule 4, by default, the package application is in the JAR archive).

ExportCommonUtility

Step 3: Add this JAR file to the local Maven repository (.m2) using Maven commands to install artifact or use Anypoint Studio's "Install file into local repository" ability. First, select the pom.xml (Mule 4 by default provide maven apps) for utility application and the corresponding jar file. There is no need to define the classifier. Click "Install."

InstallArtifactLocalRepo

Step 4: Go to the main application wherein you want to reference this application and edit the pom.xml to install the artifact as a dependency. This will ensure that the utility JAR is packaged into the main application along with other dependencies. Verify if the JAR is included under project libraries.

<dependency>
    <groupId>com.mycompany.utilities</groupId>
    <artifactId>preprocessing</artifactId>
    <version>1.0.0</version>
</dependency>
</dependencies>

Step 5: Go to the main application's Mule configuration file and open "Global Elements." Search for the "Import" option under Global Configurations, then provide the utility application's Mule configuration file that you want to reference.

GlobalElements

By doing so, you can reference all the flows from your utility application into your main application and perform data processing as required without writing similar code again.

Note: Please keep in mind that this relationship does not define the parent-child relationship. This is just a way to increase code reusability and allow the developer to create utility applications for quick development cycles.

application MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • MuleSoft: Do You Have an Extra Mule Under the Hood?
  • MuleSoft: Tactical and Strategical Role of an Application Template

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!