<commit_before># Contributing to WSO2 Identity Server

## Debugging WSO2 Identity Server development environment in Eclipse

All WSO2 products are based on a common platform called WSO2 Carbon. It is therefore essential to obtain and build this layer before attempting to build the desired product itself. The build process can be divided into three distinct steps:

1.	Build the carbon-kernel code.
2.	Build the carbon-identity-framework code.
3.	Build the WSO2 identity server code.

> **Note**: This was tested with the following versions of the products:
>  * carbon-identity-framework – v5.7.5
>  * carbon-kernel – v 4.4.11
>  * product-is – v5.3.0

###	Import source code in Eclipse IDE

WSO2 products can use the Developer Studio plugin in Eclipse. The Eclipse version (Luna Service Release 2 (4.4.2)) already contains this plugin from the following link: https://wso2.com/products/developer-studio/.

1. Import source code of carbon-kernel from GitHub: You need to import carbon-kernel code into the Eclipse IDE from GitHub. Follow the steps below to achieve this:
   *	Open Eclipse.
   *	Select workspace for carbon-identity-framework.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for carbon-identity-framework i.e., https://github.com/wso2/carbon-kernel.git and click on **Next** - **Next** - Enter Directory and click **Next** - Click **Cancel**.
   *	Again click on the **Import** option from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.
2. Import source code of carbon-identity-framework from GitHub: We have to import carbon-identity-framework code into Eclipse from GitHub. For this we have to follow the steps below:
   *	Open Eclipse.
   *	Select workspace for carbon-identity-framework.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for carbon-identity-framework i.e. https://github.com/wso2/carbon-identity-framework.git and click **Next** - **Next** - Enter Directory and click on **Next** - click **Cancel**.
   *	Again click on **Import** from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.
3. Import source code of WSO2 Identity Server from GitHub: We have to import the WSO2 Identity Server code into Eclipse from GitHub. For this we have to follow the steps below:
   *	Open Eclipse.
   *	Select workspace for identity-server.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for product-is i.e., https://github.com/wso2/product-is.git and click on **Next** - **Next** - Enter Directory and click **Next** - click **Cancel**.
   *	Again click on **Import** option from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.

###	Build source code

1. Build carbon-kernel Code: To build the source code we have to follow the below steps:
   *	Right click on carbon-Kernel project and select run as option. Then Click on Maven Build option.
   *	New dialog box “Run Configurations” will be displayed. Go to “Main” tab and write clean install in “Goals” field and click on Run button.
2. Build carbon-identity-framework Code: To build the source code we have to follow the below steps:
   *	Right click on carbon-identity-framework project and select run as option. Then Click on Maven Build option.
   *	New dialog box will be displayed. Go to “Main” tab and write mvn clean install in “Goals” field and click on Run button.
3. Build identity-server Code: To build the source code we have to follow the below steps:
   *	Right click on identity-server project and select run as option. Then Click on Maven Build option.
   *	New dialog box will be displayed, run the one of the below maven commands from product-is directory,
        * clean install (To build the binary and source distributions with the tests)
        * clean install -Dmaven.test.skip=true (To build the binary and source distribution, without running any of the unit/integration tests).

###	Run the application

1. Run the source code: To run the project, you need to follow the steps below:
   *	Right click on the `org.wso2.carbon.bootstrap` project and select **Run**. Then click on **Run Configuration**.
   *	Right click on the **Java Application** option and click **New**.
   *	Now browse the `org.wso2.carbon.bootstrap` project in the **Project** field and search the `org.wso2.carbon.bootstrap.Bootstrap` class for the **Main Class** field.
   *	Now click on the **Arguments** tab and write the below content in the **VM arguments** field:
      ```
          -Xms256m
          -Xmx1024m
          -XX:MaxPermSize=256m<commit_msg>Added instructions to do remote debug<commit_after># Contributing to WSO2 Identity Server

## Debugging WSO2 Identity Server development environment in Eclipse

All WSO2 products are based on a common platform called WSO2 Carbon. It is therefore essential to obtain and build this layer before attempting to build the desired product itself. The build process can be divided into three distinct steps:

1.	Build the carbon-kernel code. (Needed only if debugging low level user store, kernel , etc)
2.	Build the carbon-identity-framework code.
3.	Build the WSO2 identity server code.

> **Note**: This was tested with the following versions of the products:
>  * carbon-identity-framework – v5.7.5
>  * carbon-kernel – v 4.4.11
>  * product-is – v5.3.0

###	Import source code in Eclipse IDE

Contributing to IS does not require Developer Studio plugin, however all WSO2 products can use the Developer Studio plugin in Eclipse. The Eclipse version (Luna Service Release 2 (4.4.2)) already contains this plugin from the following link: https://wso2.com/products/developer-studio/.

1. Import source code of carbon-kernel from GitHub: You need to import carbon-kernel code into the Eclipse IDE from GitHub. Follow the steps below to achieve this:
   *	Open Eclipse.
   *	Select workspace for carbon-identity-framework.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for carbon-identity-framework i.e., https://github.com/wso2/carbon-kernel.git and click on **Next** - **Next** - Enter Directory and click **Next** - Click **Cancel**.
   *	Again click on the **Import** option from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.
2. Import source code of carbon-identity-framework from GitHub: We have to import carbon-identity-framework code into Eclipse from GitHub. For this we have to follow the steps below:
   *	Open Eclipse.
   *	Select workspace for carbon-identity-framework.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for carbon-identity-framework i.e. https://github.com/wso2/carbon-identity-framework.git and click **Next** - **Next** - Enter Directory and click on **Next** - click **Cancel**.
   *	Again click on **Import** from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.
3. Import source code of WSO2 Identity Server from GitHub: We have to import the WSO2 Identity Server code into Eclipse from GitHub. For this we have to follow the steps below:
   *	Open Eclipse.
   *	Select workspace for identity-server.
   *	Click on **File** - **Import** - **Projects from Git** - **Clone URI** - Enter URI for product-is i.e., https://github.com/wso2/product-is.git and click on **Next** - **Next** - Enter Directory and click **Next** - click **Cancel**.
   *	Again click on **Import** option from the file menu. Select **Existing Maven Projects** and click on **Next** - click on **Finish**.

###	Build source code

1. Build carbon-kernel Code: To build the source code we have to follow the below steps:
   *	Right click on carbon-Kernel project and select run as option. Then Click on Maven Build option.
   *	New dialog box “Run Configurations” will be displayed. Go to “Main” tab and write clean install in “Goals” field and click on Run button.
2. Build carbon-identity-framework Code: To build the source code we have to follow the below steps:
   *	Right click on carbon-identity-framework project and select run as option. Then Click on Maven Build option.
   *	New dialog box will be displayed. Go to “Main” tab and write mvn clean install in “Goals” field and click on Run button.
3. Build identity-server Code: To build the source code we have to follow the below steps:
   *	Right click on identity-server project and select run as option. Then Click on Maven Build option.
   *	New dialog box will be displayed, run the one of the below maven commands from product-is directory,
        * clean install (To build the binary and source distributions with the tests)
        * clean install -Dmaven.test.skip=true (To build the binary and source distribution, without running any of the unit/integration tests).

###	Run and debug the application
Running the Identity server can be done in two methods.
1. Remote Debug mode
2. Running inside the eclipse

### 1.  Remote Debug mode
1. Run the WSO2 IS with debug option turned on. This will cause IS to wait until eclipse connects to the JVM running the IS.
```
./wso2server.sh -debug 5005
```
2. Configure the eclipse remote debug. Please see the article [at DZone](https://dzone.com/articles/how-debug-remote-java-applicat). Please use the port as 5005.



### 2.  Running inside the eclipse
1. Run the source code: To run the project, you need to follow the steps below:
   *	Right click on the `org.wso2.carbon.bootstrap` project and select **Run**. Then click on **Run Configuration**.
   *	Right click on the **Java Application** option and click **New**.
   *	Now browse the `org.wso2.carbon.bootstrap` project in the **Project** field and search the `org.wso2.carbon.bootstrap.Bootstrap` class for the **Main Class** field.
   *	Now click on the **Arguments** tab and write the below content in the **VM arguments** field:
      ```
          -Xms256m
          -Xmx1024m
          -XX:MaxPermSize=256m
{'fraction_non_alphanumeric': 0.09497762307309796, 'fraction_numerical': 0.011337642963699652, 'mean_word_length': 3.7034611786716556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5069675', 'n_tokens_mistral': 2782, 'n_tokens_neox': 2664, 'n_words': 1387}