Hello Friends,

In this article, I want to show to you how you can skip or exclude flow from initialize and start while deploying mule4 applications in local or in cloud. Also, I will show you how you can exclude files from packaging jars.

Problem: 

In mulesoft development there are high chance of having large number of files for flows/ subflows and due to this it leads to:

  • Long build and deployment time.

  • Bulk packaging.

Above scenarios are more painful when we need a quick fix and testing of code in local or in cloud environment.

Let’s check scenario below, as we are able to see in project below we have three files under src/main/mule package. Each file is having individual flows as highlighted in picture below:

 

mule4-flows

In mule4, we have “mule-artifact.json” file where we can declare files to be considered for initializing and starting of the flows under configs tag. By default, if we don’t declare any file names, Mule runtime includes All files to check, initialize and starting of the flows.

mule-artifact-json.png

Below logs shows only “HelloWorldFlow” is initialized and started for deployment.

flow-logs

So, if we don’t declare any file to include for execution, below logs shows mule runtime started and initialized all flows from all files.

deployment
flow-logs

Although above configuration helps you to exclude flows to initiate and start while deploying application in local or in cloud. It helps to reduce total deployment time of mule apps. But with above configuration you will not be able to exclude files or folders from packaging jar.

How to exclude files or folders from packaging jars?


To achieve this, we need to create “_muleExclude” file at the root level of mule application.

_muleExclude-mule4.png

You can declare file names to exclude from packaging jar as shown above.

Above picture also shows extracted jars is not having files included inside “_muleExclude” file.

Note: Please make sure above configurations should be used wisely as it may lead to application failure.

If you want to know more about minMuleVersion you can check my article runtime-patching-in-mule-munit

Happy Learning 🙂

By Manish Kumar

I am having around 10 years of IT experience in Integration Architecture, Requirement gathering, Effort Estimation, Application Design\Development\Testing and Deployment including 5+ years of experience in MuleSoft ESB and Hybrid Integrations. DevOps and Cloud Integration is my area of interest.

One thought on “How to exclude files from deployment – Mule4”
  1. Simply want to say your article is as surprising. The clearness for your publish is simply nice and i can suppose you are knowledgeable in this subject. Well together with your permission let me to clutch your RSS feed to keep up to date with coming near near post. Thanks one million and please continue the rewarding work.

Leave a Reply

Your email address will not be published. Required fields are marked *