Deploying the WSO2 CAR file with Maven

To deploy my WSO2 Carbon Application aRchive (CAR) file to my WSO2 ESB instance I use this Maven plugin. I couldn’t find a lot of documentation about it but I post here how I use it. I added the following plugin to my pom.xml file:

<plugin>
  <groupId>org.wso2.maven</groupId>
  <artifactId>maven-car-deploy-plugin</artifactId>
  <version>1.0.0</version>
  <extensions>true</extensions>
  <configuration>
    <carbonServers>
      <CarbonServer>
        <trustStorePath>${basedir}/src/main/resources/security/wso2-localhost.jks</trustStorePath>
        <trustStorePassword>wso2</trustStorePassword>
        <trustStoreType>JKS</trustStoreType>
        <serverUrl>https://localhost:9443</serverUrl>
        <userName>admin</userName>
        <password>admin</password>
        <operation>deploy</operation>
      </CarbonServer>
    </carbonServers>
  </configuration>
</plugin>

I think this plugin is pretty straightforward. As said before I couldn’t find any documentation about it.
The last thing to do to make this work is to create the trustStore file. There are two ways (at least) to get it. The easy way is to get it from the installation directory of the WSO2 ESB. The file is named ‘client-truststore.jks’ and you can find it in the directory ‘$CARBON_HOME/repository/resources/security’. The password is ‘wso2carbon’.
The other way to get it is a little bit harder but I show it anyway. Here we go:

  • Obtain the certificate
  • Open up the management console in Google Chrome (my favorite browser). On the left side of the address bar you see a lock with a cross in it. After you click it you can browse to the certificate information:
    Screen Shot 2013-03-23 at 07.48.42
    When you clicked the link to the certificate information you see the certificate. You can now drag the certificate icon to your desktop so it is saved as file there:
    Screen Shot 2013-03-23 at 07.50.23

  • Create a truststore
  • To create the truststore we need to make a JKS keystore with the certificate in it. There are several ways to do it but I show my favorite tool again, in this case the Keystore Explorer. When you open the tool you can click the option to create a new keystore:
    Screen Shot 2013-03-23 at 07.57.57
    Next step is to import the certificate into the keystore by choosing this menu option:
    Screen Shot 2013-03-23 at 08.00.21
    Now browse to the certificate we just saved on the desktop and select it to import it:
    Screen Shot 2013-03-23 at 08.00.49
    After importing the keystore has one entry:
    Screen Shot 2013-03-23 at 08.01.18
    Now save the store. It will verify you want to trust the certificate and you will have the ability to set the password for the keystore:
    Screen Shot 2013-03-23 at 08.01.50

That is it. We now have a JKS keystore with the certificate in it to which we can point in our Maven plugin configuration.

About Pascal Alma

Pascal is a senior IT consultant and has been working in IT since 1997. He is monitoring the latest development in new technologies (Mobile, Cloud, Big Data) closely and particularly interested in Java open source tool stacks, cloud related technologies like AWS and mobile development like building iOS apps with Swift. Specialties: Java/JEE/Spring Amazon AWS API/REST Big Data Continuous Delivery Swift/iOS
This entry was posted in Maven, Security, WSO2 ESB and tagged , , . Bookmark the permalink.

4 Responses to Deploying the WSO2 CAR file with Maven

  1. surlac says:

    Why you prefer deployment with Maven instead of WSO2 Developer-Studio?

    • Pascal Alma says:

      The main reason is that I am not a big fan of Eclipse tool. I have had some issues with the Developer studio messing up my xml files after editing with the ‘wizard’. So I use the Eclipse tool as least as possible and rather use Maven for the complete chain of compiling/ testing/ packaging and deploying. That way I can use any Java IDE I like (like Netbeans or my favorite: IntelliJ)

Comments are closed.