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
- Create a truststore
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:
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:
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:
Next step is to import the certificate into the keystore by choosing this menu option:
Now browse to the certificate we just saved on the desktop and select it to import it:
After importing the keystore has one entry:
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:
That is it. We now have a JKS keystore with the certificate in it to which we can point in our Maven plugin configuration.
Why you prefer deployment with Maven instead of WSO2 Developer-Studio?
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)
Oh my, I’m so familiar with what you said. I’m trying to switch from IntelliJ IDEA to Developer studio just because of CAR deployment, but it is really pain in the eyes to use Eclipse. Can you post example of your maven project for WSO2 (for example packing a proxy xml in CAR and deploying to ESB)? Thanks! This blog-post is unique.
I can’t give a complete example right now but I found this blog which might be helpfull (with a little help of Google translate 🙂 ): http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http%3A%2F%2Fbarbitoff.blogspot.nl%2F2013%2F04%2Fwso2-carbon-car-maven.html