Deploying a CAR File with the Maven Plug-In
This page walks you through how to deploy a CAR file containing ESB artifacts using the Maven plug-in. It includes the following sections:
This sample refers to the following products and their versions:
WSO2 ESB - 4.7.0 and 4.8.1
WSO2 Developer Studio - 3.2.0
Create an ESB Config Project
Follow the steps below to create an ESB config project:
- Open the Eclipse instance running WSO2 Developer Studio.Â
- Click Developer Studio > Open Dashboard to open the Developer Studio Dashboard.
- Click ESB Config Project under the Enterprise Service Bus category.
- Enter the project name as ESBDeploySample and click Finish.
Create a Proxy Service
Click the ESBDeploySample project in the Project Explorer.
Click Developer Studio > Open Dashboard. Click Proxy Service.
Enter the proxy service name as ProxySample.
Now you have a simple proxy service that you can deploy to WSO2 ESB.
Create a Composite Application Project
Open the Developer Studio Dashboard and click Composite Application Project under the Distribution category.
Enter the project name as CappSample and click Finish.
Open the pom.xml file of the CappSample project and select the check box for the ESBDeploySample project to add it to the C-App.
In the Source view of theÂ
pom.xml
 file, add following code snippet under theÂ<plugins>
 element. (Make sure you add this plugin after the existing entry for maven-eclipse-plugin):<plugin> <groupId>org.wso2.maven</groupId> <artifactId>maven-car-deploy-plugin</artifactId> <version>1.0.0</version> <extensions>true</extensions> <configuration> <carbonServers> <CarbonServer> <trustStorePath>/home/sohani/Desktop/ESB/wso2esb-4.7.0/repository/resources/security/wso2carbon.jks</trustStorePath> <trustStorePassword>wso2carbon</trustStorePassword> <trustStoreType>JKS</trustStoreType> <serverUrl>https://localhost:9443</serverUrl> <userName>admin</userName> <password>admin</password> <operation>deploy</operation> </CarbonServer> </carbonServers> </configuration> </plugin>
Give the actual location of thewso2carbon.jks
file at the<trustStorePath>
element ($ESB_HOME/repository/resources/security/wso2carbon.jks
).- Save your changes.
Deploy CAR file to the WSO2 ESB server
Start the WSO2 ESB server in your machine.
Build the ESBDeploySample project using theÂ
mvn clean install
 command.Build the CappSample project using the commands listed below.
In order to enable the deployment of a CAR file to a Carbon Server, you can do one of the following,
- AddÂ
<maven.car.deploy.skip>false</maven.car.deploy.skip>
 to the properties section of the C-App project'sÂpom.xml
 file - ProvideÂ
-Dmaven.car.deploy.skip=false
 with the mvn clean deploy command. E.g:Âmvn clean deploy -Dmaven.car.deploy.skip=false
After building the project, you can see that the ProxySample proxy service has been deployed to the sever as shown in the figure below:
In order to disable the deployment of a CAR file to a Carbon Server, you can do one of the following:
- AddÂ
<maven.car.deploy.skip>true</maven.car.deploy.skip>
 to the properties section of the C-App project'sÂpom.xml
 file - ProvideÂ
-Dmaven.car.deploy.skip=true
 with the mvn clean deploy command. E.g:Âmvn clean deploy -Dmaven.car.deploy.skip=true
In order to undeploy the deployment of a CAR file to a Carbon Server,Â
Provide -Doperation=undeploy -Dmaven.deploy.skip=true -Dmaven.car.deploy.skip=false
 with the mvn clean deploy command. E.g: mvn clean deploy -Doperation=undeploy -Dmaven.deploy.skip=true -Dmaven.car.deploy.skip=false