Using domain project

In previous article I have described how to create a custom domain project. This time we will try to consume that. In other words we will attach Mule application to our previously defined domain.


Just to recap. Let us see how our domain looks like. We have a profit-domain project with global configuration and one yaml file. We have also embedded dependencies to HTTP, JMS and Sockets modules. As a result all connected applications should have the same global configuration and basic modules. Like in the diagram below.

Domain project
Domain project

When we have domain project in place, it is time to link it with our project. Those of you, familiar with Mule 3, will find first changed in new release. As there is no longer mule-project.xml file, where we used to set it up.

You need to click on the project name and from the drop down menu select Properties. Then you need to navigate to Mule Project. You can select your domain project from the drop down menu next to Domain property. Like in the diagram below.

Mule Project settings
Mule Project settings

In my sample application, order-app, I have selected domain called profit-domain. As domain is already linked with runtime, Server Runtime property has been grayed out but filled with the correct Runtime from the domain.

Click Apply and Close and that is all.

Existing modules

When you decide to share common set of Mule modules in domain project you may face “existing modules” problem. In the moment you choose your domain project, like described above, you will see  a notice with warning icon. 
The text is as follows:
“Existing modules conflicts with domain. Go to Problems view for more details.”
You may be tempted just to ignore it. With this warning you won’t be able to build a project. Bear that in mind.

Configuration usage

From now on, you may link to global configuration elements from your flows. Anypoint Studio will auto-populate appropriate drop-down lists. Access to global properties from yaml file is the same as if it was in the current project like ${}


By now you should know how to increase your code quality by sharing common configuration and properties using domain project. You are aware that you could share also a functionality and awesome DataWeave functions that you have created. In order to do this you use custom maven project – this is described in this article.

If you have any interesting ideas about sharing/reusing or anything related to project quality feel free to share it :).

Using domain project

One thought on “Using domain project

Leave a Reply

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

Scroll to top