> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endorlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.endorlabs.com/feedback

```json
{
  "path": "/integrations/package-managers/gradle-private-package-manager/index",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Private package manager integration for Gradle

> Learn how to configure Endor Labs to access private Gradle repositories for dependency resolution and security scanning.

Configure Endor Labs to integrate with private Gradle repositories to access proprietary dependencies during security scanning and analysis. When your Gradle projects depend on artifacts hosted in private or corporate repositories, Endor Labs requires authentication credentials to resolve these dependencies and generate a complete bill of materials.

This integration enables Endor Labs to:

* Access private Gradle artifacts during dependency resolution
* Generate comprehensive security analysis including private dependencies
* Maintain complete visibility into your software supply chain

Endor Labs integrates with your self-hosted package repositories and source control systems to give you visibility into your environment. Package manager integrations let you simplify scanning using custom repositories.

Endor Labs generally respects package authentication and configuration settings and a package manager integration is usually not required to scan private packages successfully.

* Use package manager integrations to simplify scanning when authentication to private repositories is not part of standard manifest or settings files.

* Package manager integrations allow you to set custom repositories for each package ecosystem and the priority of each repository for scanning.

To set up a package manager integration:

1. Sign in to Endor Labs and select **Integrations** from the left sidebar.
2. Click **Add** next to the package manager configuration you want to add.
3. Click **Add Package Manager**.
4. Enter the name of the package manager.
5. Select either **Basic** or **AWS Code Artifactory** as **Authentication Type**.

   See [AWS authentication](/integrations/package-managers/aws-codeartifact) for more information.

### Authenticate to Gradle private package repositories

To connect to private Gradle repositories, enter the package registry credentials such as property key and property value.

<img src="https://mintcdn.com/endorlabs-b4795f4f/dHzwUrp_QbpzV9uv/images/integrations/package-managers/basic-authentication-gradle.webp?fit=max&auto=format&n=dHzwUrp_QbpzV9uv&q=85&s=f8fb3e78661e8e7e5fe3517cac59acaf" alt="Basic Authentication for package manager integrations" width="1716" height="962" data-path="images/integrations/package-managers/basic-authentication-gradle.webp" />

### Test package manager integration

You can test the connection to a configured package manager to verify that Endor Labs can reach the repository. To test the connection:

1. Select **Integrations** from the left sidebar.
2. Click **Manage** in the package manager configuration you want to customize.
3. Click the vertical three dots of the package manager configured and select **Test Connection**.

<Note>
  The integration does not perform authentication or authorization checks on the package manager repository.
</Note>

### Edit package manager integration

You can edit an existing package manager integration to update the name, repository URL, or authentication credentials. To edit a package manager integration:

1. Select **Integrations** from the left sidebar.
2. Click **Manage** next to the package manager you want to edit.
3. Click the vertical three dots on the configured integration you want to edit and select **Edit**.
4. You can modify the name, package manager URL, and credentials.
5. Click **Save Changes**.

## Private package manager integration for Gradle using API

Configure private package manager integration with Gradle to authenticate and fetch dependencies from private repositories during scans.

Gradle requires valid credentials, such as AWS access keys and GitHub or GitLab tokens, to access private repositories and fetch dependencies. Provide these credentials through the endorctl API call for GitHub App scans to run successfully.

The variable names you define (like `mavenAccessKey`, `mavenSecretKey`) must exactly match the property names used inside your `build.gradle` file when configuring credentials. For more information on how to align variable names with your build configuration, refer to [Declaring private repositories.](https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:declaring-custom-repository-basics)

<Note>
  You can configure these credentials for the scans performed through the GitHub App.
</Note>

### Set Gradle credentials

Use endorctl to configure your repository credentials. You can set the necessary Gradle properties, allowing access to private repositories during the Gradle build process.

For example, to authenticate with an AWS S3-backed Maven repository, run the following commands to set the `mavenAccessKey` and `mavenSecretKey` properties. Replace `namespace` with your namespace.

```shell theme={null}
endorctl api create -n <namespace> -r PackageManager -d '{
    "meta": {
        "name": "gradle properties"
    },
    "spec": {
        "gradle": {
            "property_key_name": "mavenAccessKey",
            "property_key_value": "your-access-key"
        }
    }
}'
```

```shell theme={null}
endorctl api create -n <namespace> -r PackageManager -d '{
    "meta": {
        "name": "gradle properties"
    },
    "spec": {
        "gradle": {
            "property_key_name": "mavenSecretKey",
            "property_key_value": "your-secret-key"
        }
    }
}'

```

These credentials will then be available to your Gradle build at scan time. All values configured through the API are automatically exported as environment variables.

### Considerations

When configuring Gradle credentials, consider the following scenarios:

#### AWS credentials with scan profile

If you link a scan profile to your project, AWS credentials are directly written into `~/.gradle/gradle.properties` and require exact key matches. You can use one of the following combinations:

* `AWS_ACCESS_KEY` and `AWS_SECRET_KEY`
* `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`

#### Authenticate using mutual TLS

Use mutual TLS to securely authenticate to artifact repositories. Currently, you can configure mutual TLS only through the API. See [mTLS authentication](/integrations/package-managers/mtls-authentication) for more information.

### Fetch package manager using API

Run the following command to fetch the package manager using the UUID.

```bash theme={null}
endorctl api get -r packageManager -n <your namespace>  --uuid <package-manager-uuid>
```

### Delete package manager using API

Run the following command to delete the package manager using the UUID.

```bash theme={null}
endorctl api delete -r packageManager -n <your namespace>  --uuid <package-manager-uuid>
```
