Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 invites you to contribute by downloading the source code from the GitHub source control system, building the product and making changes, and then committing your changes back to the source repository. The following sections describe this processThe source code of all WSO2 products as well as the scripts that are used for building WSO2 products are maintained in GitHub repositories. If you are a developer, you can easily clone the source code from these Git repositories, and if required, you can do modifications and build a customized product on your own.

See the following topics for instructions on how to work with WSO2 Git repositories:

...

WSO2 products are built on top of WSO2 Carbon Kernel, which contains the Kernel libraries used by all products. When there are changes in the Carbon Kernel, they are bundled and released in a new WSO2 Carbon version (for example, WSO2 Carbon 4.3.0). You can download the complete WSO2 Kernel release using the following repository: 

Table of Contents
maxLevel3

Info

Building from source is optional. Users who do not want to make changes to the source code can simply download the binary distribution of the product and install it.

minLevel3

Identifying WSO2 Git Repositories

In GitHub, the WSO2 source code is organized into separate repositories, and each WSO2 product is built using several of these repositories. Therefore, if you are interested in editing the source code and building a customized product, you need to first identify the Git repositories that you require.

Info

For the complete list of repositories used by WSO2 products, see this link.

The Git repositories used by WSO2 products are of two categories: 

  • Feature repositories: A feature repository consists of the source code relevant to a particular component. Each WSO2 product release is built using combinations of these feature repositories. Therefore, if you want to do modifications to a particular function in a product, you need to clone the Git repositories relevant to that function. Note that each repository will also consist of Tag IDs, which corresponds to the tag that was used for a particular product release. If you want to know more about other component repositories and the tags used for a product release, send an email to dev@wso2.org.
     

  • Product-build repository: A product-build repository consists of the build scripts and profiles that are used for building the product. It also includes the Integration test cases. You can simply clone this repository tag to your computer and build it to get a standard product pack. When you build a product-build repository, all the component repositories that are required for that product release will be automatically fetched from Nexus. See the topic on Building from Source.

Cloning a Git repository

Given below are the steps that you need to follow in order to clone a Git repository to your computer.

  1. Clone the repository, so that the files that are in the WSO2 Git repository are available on your computer:

    git clone <DEPENDENT_REPOSITORY_URL> <LOCAL_FOLDER_PATH> 

    For example, clone the carbon-commons repository, which is in the WSO2 Git repository, to a folder named CC_SOURCE_HOME on your computer:
    git clone https://github.com/wso2/

...

Note

After the source code is downloaded, you can start editing. However, it is recommended to run a build prior to changing the source code to ensure that the download is complete.

After downloading the source of the Carbon Kernel, execute the following command to download the source of the product: git clone https://github.com/wso2/product-mb

...

Ensure that the following prerequisites are in place before you build:

  1. Make sure the build server has an active Internet connection to download dependencies while building.
  2. Install Maven and JDK. For compatible versions, see Installation Prerequisites.
  3. Set the environment variable MAVEN_OPTS=”-Xms1024m -Xmx4096m -XX:MaxPermSize=1024m” to avoid the Maven OutOfMemoryError.

...

  1. carbon-commons.git /Users/testuser/Documents/CC_SOURCE_HOME 

  2. Navigate to the folder in your computer to which the code base is cloned:
    cd <DEPENDENT_REPOSITORY_FOLDER_PATH> 

    Example:
    cd /Users/testuser/Documents/CC_SOURCE_HOME

  3. Clone the dependent repository tag that corresponds to the version of the code base:  
    git checkout -b <REMOTE_BRANCH/TAG> <LOCAL_BRANCH>

    Note

    The local branch name should be identical to the remote branch name.

    For example, if you want to download the carbon-commons repository tag that was used for the WSO2 AS 5.3.0 release, you need to clone the v4.4.7 tag:

    git checkout -b v4.4.7 v4.4.7

Building a WSO2 product from source

As explained above in the section on identifying WSO2 Git repositories, you can easily build a product pack by building the product-build Git repository on your computer. However, if you have modified any of the feature repositories that are used for this product, you need to first build those feature repositories before building the product-build repository. Given below are the steps you need to follow.

Info

Use Maven to build your repositories. See the next topic for instructions on how to use Maven for building repositories.

  1. Build all the feature repositories that you have cloned to your computer and edited. Be sure that you build the repositories in the correct order. Email dev@wso2.org to get help.

  2. Once you have built the feature repositories, build the product-build repository that you have cloned to your computer.

    When you build the product repository, Maven will first check in the local Maven repository on your computer and fetch the repositories that you built in Step 1. Maven will then fetch the remaining dependent repositories from Nexus. This process will give you a new product pack with your changes. 

    You can find the new binary pack (ZIP file) in the <PRODUCT_REPOSITORY_HOME>/modules/distribution/target directory.

Using Maven to build Git repositories

You can use Maven to build the Git repositories that you clone to your computer. 

Info

Prerequisites for using Maven:

  • Install Maven and JDK. See the Installation Prerequisites page for compatible versions. 
  • Set the environment variable to avoid the Maven OutOfMemoryError as follows:

    JDK VersionEnvironment Variable Setting
    JDK 7MAVEN_OPTS="-Xms1024m -Xmx2048m -XX:MaxPermSize=1024m"
    JDK 8MAVEN_OPTS="-Xms1024m -Xmx2048m"

Use one of the following Maven commands to build your repositories:

CommandDescription
mvn clean install

The binary and source distributions.

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 have already built the source at least once.

Committing your changes

...

.