Follow the instructions below to set up a development environment for Apache Stratos:

Setting up Apache Stratos source

  1. Download and install JDK 1.6 on your computer.
  2. Create the JAVA_HOME environment variable, and point it to <JAVA_HOME>.

    <JAVA_HOME> refers to the installation directory of JDK.

  3. Download and install Apache Maven (3.0.0 or later) on your computer.
  4. Create the M2_HOME environment variable, and point to <MAVEN_HOME>.

    <MAVEN_HOME> refers to the installation directory of Apache Maven.

  5. Set the MAVEN_OPTS environment variable as follows:
    MAVEN_OPTS="-Xms512m -Xmx1536m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=256m" 
  6. Install a preferred Java IDE, and make sure Maven support is available.
  7. Checkout Apache Stratos source code from its Git repository as follows: 
    git clone https://git-wip-us.apache.org/repos/asf/stratos.git

    Select the Apache Stratos source code of the required release version, from the master branch of the Git repository.

  8. Set the STRATOS_SOURCE environment variable, and point it to <STRATOS_HOME>.

    <STRATOS_HOME> refers to the directory created by the Git clone in the previous step, which includes Apache Stratos source code.

Setting up Eclipse IDE

Use either simple method or advanced method to set up Eclipse IDE as described below:

Simple method

  1. Navigate to <STRATOS_HOME> using the command line terminal.
  2. Execute the command below to install Eclipse IDE:
    mvn clean install eclipse:eclipse
  3. In the Eclipse IDE, click General in the Import menu, and click Existing Projects into workspace.
  4. Navigate to <STRATOS_HOME> and select Search for nested projects.
  5. Click Select all, and then click Finish to select all the listed projects.
  6. Make any required code changes in Eclipse editor.
  7. Execute the command below from CLI, to build Stratos:
    mvn clean install 
  8. Proceed to run or debug a product.

Advanced method

  1. Import root pom.xml file, which is in <STRATOS_HOME>, to the IDE as a Maven project.
  2. Execute the Maven clean and Maven install life-cycles of the root pom.xml file to build the complete project, using the command below:
    mvn clean  install 

    This will build all service stubs, components, features, products, and extensions of the project.

  3. Browse for the preferred components of the product in the IDE, on which you like to contribute, and make any required code changes.
  4. Proceed to run or debug a product.

Running or debugging a product (on Linux/Unix)

  1. Navigate to <STRATOS_HOME>/products/<PRODUCT_NAME>/modules/distribution/target/ directory.
  2. Extract the product's binary distribution file.   

  3. Navigate to <PRODUCT_HOME>/bin/ directory. <PRODUCT_HOME> refers to the folder, which was extracted in the previous step.
  4. Execute the following command to run the product:
    stratos.sh 
  5. Execute the following command to start Apache Stratos in debug mode. 
    stratos.sh --debug <PORT> 
    Now a remote debugger can be attached to the specified port via the IDE.