This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Building from Source

WSO2 invites you to contribute by checking out the source from the Subversion (SVN) source control system, building the product and making changes, and then committing your changes back to the source repository. (For more information on Subversion, see http://svnbook.red-bean.com.) The following sections describe this process:

Building from source is optional. Users who do not want to make changes to the source code can simply download the binary distribution of WSO2 ESB

Checking out the source

WSO2 products are built on top of WSO2 Carbon Kernel, which contains the Kernel libraries used by all products.  A WSO2 platform release is a set of WSO2 products based on the same Carbon release. When there are changes in the Carbon Kernel, they are bundled and released in a new WSO2 Carbon version (for example, WSO2 Carbon 4.1.0).

Checking out the patches

Before checking out the product source, you need to checkout the patches related to the Carbon chunk using the following command.

$ svn checkout https://svn.wso2.org/repos/wso2/carbon/kernel/branches/<WSO2-Carbon-version>/ <local-platform-directory-1>

Replace <local-platform-directory-1> with a meaningful name, such as wso2carbon-platform.

Also replace <WSO2-Carbon-version> in the above command with the WSO2 Carbon version, on which a specific product version is based. To find out the WSO2 Carbon version, see the Release Matrix. For example, for products based on WSO2 Carbon 4.1.0, the command is as follows:

$ svn checkout https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/patches/ <local-platform-directory-1>

Downloading the product source

Download the product source using the checkout command as shown below.

$ svn checkout https://svn.wso2.org/repos/wso2/carbon/platform/tags/<WSO2-Carbon-version>/products/ <local-platform-directory-2>

Replace <local-platform-directory-2> with a meaningful name, such as wso2carbon-platform.

To find out on the WSO2 Carbon version, which a specific product version is based on, see the Release Matrix. Replace <WSO2-Carbon-version> in the above command with it. For example, for products based on WSO2 Carbon 4.1.0, the command is as follows:

$ svn checkout https://svn.wso2.org/repos/wso2/carbon/platform/tags/4.1.0/ <local-platform-directory-2>

Setting up your development environment

Before you edit the source code in your IDE, set up your development environment by running one of the following commands:

If you are using this IDE...Run this command...Additional information
Eclipsemvn eclipse:eclipse http://maven.apache.org/plugins/maven-eclipse-plugin
IntelliJ IDEAmvn idea:idea http://maven.apache.org/plugins/maven-idea-plugin

If you are using a later Eclipse version and if you get errors (library path etc.) when trying to import the source code using the Existing Projects into Workspace, follow the steps below to solve them by importing the source code as a Maven project.

  1. Build the source using the command: mvn clean install
  2. Open Eclipse and click Import in the File menu and then click Existing Maven Projects as shown below: 

Building the product 

Follow the instructions below to build the product after editing the source code:

Make sure the build server has an active Internet connection to download dependencies while building.
  1. Install Maven and JDK. See Installation Prerequisites for compatible versions. 
  2. Set the environment variable  MAVEN_OPTS="-Xms1024m -Xmx4096m -XX:MaxPermSize=1024mto avoid the Maven OutOfMemoryError.
  3. Navigate to each folder representing the patches within the  <local-platform-directory-1> and run the following Apache Maven commands to build the patches. For information on the patches, which are applicable for the respective Carbon chunk release, go to Release Matrix

    This command...Creates...
    mvn clean install

    The binary and source distributions of the chunk release.

    mvn clean install -Dmaven.test.skip=trueThe binary and source distributions, without running any of the unit tests.
    mvn clean install -Dmaven.test.skip=true -o
    The binary and source distributions, without running any of the unit tests, in offline mode. This can be done only if you've already built the source at least once.
  4. To create complete release artifacts of the products released with this chunk version, including the binary and source distributions, go to  <local-platform-directory-2>/repos/wso2/carbon/platform/tags/<WSO2-Carbon-version>/products/ directory  and run the Apache Maven commands stated in the above step. To build only a selected product/s, open  <local-platform-directory-2>/repos/wso2/carbon/platform/tags/<WSO2-Carbon-version>/products/pom.xml file, and comment out the products you do not want to build and run the relevant Maven command. 

After building the source, you can find the artifacts/product binary distribution package of the product in the <local-platform-directory-2>/products/<product_name>/<product_release_version>/modules/distribution/target/ directory.

Committing your changes 

If you are a committer, you can commit your changes using the following command (SVN will prompt you for your password):

$ svn commit --username your-username -m "A message"