Discover our knowledge. Read our blogs!

Learn more

We build all our solutions with WSO2 and we are proud that we are Platinum Value-Added Reseller of WSO2.

Learn more

Building open source WSO2 API Manager from scratch

7 min read

blog-2020-10-15-building-wso2-apim-from-scratch600pxWSO2 API Manager is a unique product in the sense that there is an open source version. You can use it and look into the source without any cost. There’s also version with product support that will ensure that you always have the latest and greatest version with regards to security and product patches. For most organizations, the product support version is preferable. In this blog, we will take a look on how to download the source code and build the source code yourself as well as identifying the download location for the open source version of the WSO2 API Manager.

This blog is based on WSO2 API Manager 3.1 but will work similarly for WSO2 API Manager 3.2.

GitHub

It all starts when you look at the GitHub repository for the API Manager. GitHub is the place where WSO2 keeps the source code of the products and versions. The URL is simple: https://github.com/wso2

blog-2020-10-15-building-wso2-apim-from-scratch-github

blog-2020-10-15-building-wso2-apim-from-scratch-github-wso2apim

When we go to https://github.com/wso2/product-apim/issues and scroll down to the bottom of that page, you will find the assets and a compiled version of the WSO2 API Manager 3.1 as well as the source code. Let's download both and see what the differences are.

blog-2020-10-15-building-wso2-apim-from-scratch-wso2-apimanager-assets

Of course, there's the difference in size, 420 megabytes versus 83.3 megabytes. This is due to the difference in source code and compiled code. Let's unzip the product WSO2 API Manager to the desktop and see if we can compile the version ourselves.

blog-2020-10-15-building-wso2-apim-from-scratch-wso2-apim-zip-file

When you open up the directory of the unzipped source code, you'll find a so-called POM file. In this file, you find the product build information to create your own compiled API Manager. This POM file is used to build the product in the correct way, for instance the required modules, repositories and dependencies. In order to build it, you need a tool like Maven. In theory, other build tools are also possible but that require rework of the POM file.

blog-2020-10-15-building-wso2-apim-from-scratch-pom-file

Building the product

blog-2020-10-15-building-wso2-apim-from-scratch-command-line-1

The build command is pretty simple:

mvn clean install -Dmaven.test.skip=true

It will take a small amount of time. It needs to download all of the dependencies to do the build and then do the build itself. It will take about 25 minutes to complete the build.

blog-2020-10-15-building-wso2-apim-from-scratch-build-time

The zip file can be found at /opt/wso2/Desktop/product-apim-3.1.0/modules/distribution/product/target

blog-2020-10-15-building-wso2-apim-from-scratch-wso2am-3..0.zip

Comparing sizes

The file size is comparable as far as size goes. But what are the differences?

blog-2020-10-15-building-wso2-apim-from-scratch-size-difference-1

blog-2020-10-15-building-wso2-apim-from-scratch-size-difference-2

I am going to use Meld on Linux to compare the directories.

blog-2020-10-15-building-wso2-apim-from-scratch-Meld-Linux

The difference is the timestamp in the file itself.

blog-2020-10-15-building-wso2-apim-from-scratch-Meld-Linux-timestamp

And there are files that have a timestamp in the filename.

blog-2020-10-15-building-wso2-apim-from-scratch-Meld-Linux-timestamps-in-name

So, it looks like the two are quite similar, apart from the aforementioned examples.

Testing it

Let us try the newly compiled version. We will start the WSO2 API Manager using the wso2server.sh script and deploy the default sample API. This is not an ultimate test of course; you would typically use a test plan to test a new version (either downloaded or self-compiled). For now, we skip all steps to deploy the sample API and

blog-2020-10-15-building-wso2-apim-from-scratch-GET-menu-pizzashack-api

And it works. Again, this is not a conclusive test, but it is a quick show of success.

If you would like to know more about WSO2 API Manager or about WSO2 Support, please feel free to leave a comment below or to contact us.

New Call-to-action

Care to share?
   
Picture of Rob Blaauboer
Published October 15, 2020

Rob Blaauboer

Rob is an Integration Consultant & WSO2 Trainer with more than twenty year experience. In addition to his work he is an active blogger working on a number of articles on the ‘Internet of Things’ and a WSO2 ‘Getting Started with …’ series (WSO2 tutorial) in which he talks about WSO2 components and their purpose especially aimed at non-technical readers. Rob is a WSO2 expert and official WSO2 trainer.

Responses

Stay up to date with the latest articles