View
139
Download
3
Category
Preview:
Citation preview
Deploy apps in standalone with Maven
By Anirban Sen Chowdhary
There are various ways to deploy your Mule application. You can deploy your Mule application in Mule standalone in various ways…..One of the easiest way is to deploy your application in server is by using Maven
So, How can we deploy our application using Maven ?
?
Yes .. We can .. I will show you this trick .. How ??
So, to build your application using Maven you need Maven installed in your system . You can get Maven from https://maven.apache.org/ So, if you have Maven already installed in your system, you need to create a Mule Project with Maven from your Anypoint Studio :-
You need to enable Maven while creating the project .. This will create a pom.xml for the project …
You can see the pom.xml is created with the project . Now this is the file where you need to add all the Library dependencies for your project
So let our flow be simple, We will display a payload in the browser after we hit a url http://localhost:8081/ in the browser:-
The corresponding Mule flow will be as follows:-
So as you can see , we will be displaying “This is a test Data” payload in the browser if we hit url http://localhost:8081/ :-
Now to deploy our application using Maven your need to first set your MULE_HOME with the path of your standalone server
Now, you need to put the following in your pom.xml
This line of code will copy the deployable Mule zip file into apps folder of Mule Standalone server. But for that you must set MULE_HOME in your Environment variable
So, let’s build our Mule application using Maven.If you have Mule plugins installed in your Anypoint Studio you can build the application, following way :
If you don’t have Maven plugins, you can build it from command prompt
Now we can execute our pom.xml to build the application and deploy into our Mule Standalone and we will get the following result in our console :-
We can see that the application has build successfully
If we go to our Mule Standalone apps folder we will see the application has been build into deployable zip file and copied into that location
The file is placed in apps folder of our Mule Standalone
If we start our Mule Standalone server, we will find the application is deployed successfully !!
To test the application if we hit the url http://localhost:8081/ in browser we will get the response in the browser :
You can see we have deployed a Mule application in Mule Standalone using Maven
In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow
Thank You
Recommended