In this blog we'll provide some insight into the WSO2 source code structure and how to modify and build your own custom version of WSO2 products that meets your specific needs. Knowledge of Maven and Git is useful but not required as we'll try to give a thorough explanation of what commands to issue, why and what they do. If you are planning on building WSO2 products you will require 3 applications:
- a Git client to obtain the source code
- a Java8 JDK
- Maven to compile the source code.
WSO2 provides a full suite of integration products, known as the WSO2 stack. These include the Enterprise Integrator (which now combines the previous single products: Enterprise Service Bus, Data Services Server and the Business Process Server), the API Manager and the Identity Server which are the more commonly/broadly used.
WSO2 products are open source, meaning it is possible for anyone to obtain the source code and build the products themselves. This can come in handy if you have requirements or demands that WSO2 will not implement or would take too long to implement. In this case you can modify the source code yourself and build your personalized version of the products, leveraging the already tried and tested source code base from WSO2.
In effect this means anyone can customize the products to meet their needs if they are willing to accept the loss of product support (WSO2 can't support customized versions as they would have no way to know what changes have been done).
Previously (before Carbon 4.4.x) WSO2 used a hybrid approach where most of the source code would be available via their SVN server with some build dependencies being available on GitHub. Building products who used this approach was a complicated affair, covered in a previous blog. Since then WSO2 has changed their approach and all their source code is now available directly on GitHub under their official GitHub user: WSO2.
Building one of the products is now straight forward:
1. You need to check the code out by cloning the correct repository. WSO2 has 270+ public repositories which might make it hard to identify which one you need. A good point to start is by searching the repositories for the ones beginning with "product-" this will list all the main product repositories. Once you have the URL for the desired repository you can clone it with Git:
> git clone https://github.com/wso2/product-<product short name>.git, replacing the name in the previous command with the appropriate product (is / ei / apim / ...)
2. Run the build process. WSO2 projects are maven projects so you will require maven to be installed on your machine. If you have it, you can simply run the command:
> mvn clean install
At the time of the writing of this blog, building the Enterprise Integrator ran into an issue while creating the profiles where some signed jar files were not correctly validated by the latest JDK. This was due to some certificates not being trusted in the most recent JDK version and can be easily solved by downloading and unzipping java8-jdk-122 and setting the JAVA_HOME variable to point to this version before running the command mentioned above.
The build process is quite lengthy the first time around as it needs to first collect all the dependencies from the internet / maven artifact repositories. It should be noted that the "product-..." repositories contain just the top layer of the WSO2 products. This means the build will generate the .zip artifact publicly available from the WSO2 website. By looking into the pom.xml in the root directory of the cloned repository we can see its large but simple.
All in all, the decision from WSO2 to move from SVN to GitHub has made working with the source code a much simpler process and less prone to errors. While it still has some issues (because the build is dependent on a specific JDK version) building any WSO2 product from source code has become a very simple task albeit a lengthy one. Look for the next blog in this series where we cover how to build your own custom/modified version of a WSO2 product.