# Use Jenkins with CodeScan Salesforce project

The following is a guide to setting up Jenkins for use with CodeScan. It assumes that:

* You have **Jenkins** installed.
* You have the **Ant** and **Git plugins** for Jenkins installed.

### Creating a Jenkins Project to use with [CodeScan](https://www.codescan.io/) <a href="#creating-a-jenkins-project-to-use-with-codescan" id="creating-a-jenkins-project-to-use-with-codescan"></a>

1. Create a **new Freestyle project**.
2. Add a **String parameter**:
   * Name it ***sonar.projectVersion***
   * Make the default value ***1***
3. Add another **string parameter**:
   * Name it ***salesforce.username***
   * Make the default value your Saleforce username eg. **<will@example.com>**
4. Add a **password parameter**:
   * Name it ***salesforce.password***
   * Make the default value your Salesforce password + your Salesforce token eg. **passwordtoken**
5. Add another **string parameter**:
   * Name it ***salesforce.url***
   * Make the default value [https://login.salesforce.com](https://login.salesforce.com/) to pull from your production instance or <https://test.salesforce.com/> to pull from your sandbox instance
6. Add another **string parameter**:
   * Name it ***sonar.projectKey***
   * Make the default value ***project1***
7. Add another **string parameter**:
   * Name it ***sonar.projectName***
   * Make the default value whatever you like. This will be the name displayed in SonarQube™.
8. Add another **string parameter**:
   * Name it ***sonar.host.url***
   * Make the default value the url of your SonarQube™ instance. The default for SonarQube™ running locally would be **<http://localhost:9000>**
9. In the build section of the configuration click **Add Build Step > Invoke Ant**.
   * In the targets section write ***deletesrc download***.
   * In the Build File section, fill in the path to the ***antbuild.xml*** file in the runner folder of your CodeScan installation. eg. ***C:/great-tools/sonar-salesforce-plugin3.x/runner/antbuild.xml***
   * In the Properties section, type ***user.dir=${WORKSPACE}***
   * Leave the Java options blank.
10. Add another **Invoke Ant step**:
    * In the targets section write ***sonar***.
    * In the Build File section, fill in the path to the ***antbuild.xml*** file in the runner folder of your CodeScan installation. eg. ***C:/great-tools/sonar-salesforce-plugin3.x/runner/antbuild.xml***
    * In the Properties section, type ***user.dir=${WORKSPACE}***
    * In the java options add the path to your temp directory. eg. **-Djava.io.tmpdir=C:\Users\some-guy\AppData\Local\Temp**\\
    * You can also add ***-Xmx1024m*** to the end of the Java options field to assign memory.

Save the **project** and click **Build with Parameters**. The results will be available in SonarQube™.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.autorabit.com/product-guides/codescan/codescan-integration/jenkins/use-jenkins-with-codescan-salesforce-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
