---
schema_version: "1"
id: 13729f56d1943b9169e25de9314b31a132dd79793f8763c63fa05bcdfb248ba8
title: External Libraries
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-sdk/latest/external-libs.md
canonical_url: https://docs.mulesoft.com/mule-sdk/latest/external-libs
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 76432f355a9fb3f45fa7ce13a065ee40aa7a2574f64a5d974d3493744474c134
description: MuleSoft Documentation Site
release: "1.13"
latest: true
---
---
product: Mule SDK
version: 1.13
is-latest-version: true
keywords: mule, SDK, library, dependency, external, jar, maven
---

# External Libraries

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Connectors and Modules sometimes depend on external libraries that cannot be packaged inside the
connector due to licensing, versioning, custom libs, and so on.

The Database connector is an example of a case where the same base code you can work with several
different drivers and several versions of a same driver. The solution to this problem is ask users
of the Database connector to identify the JDBC Driver to use for the database to which they want to
connect.

## Usage

To declare that the Connector or Module requires an external library to work in a Mule app, you need
to annotate your `@Extension`, [Configuration](https://docs.mulesoft.com/mule-sdk/latest/configs), or [ConnectionProvider](https://docs.mulesoft.com/mule-sdk/latest/connections) class
with the `@ExternalLib` annotation and provide properties that will help the Mule App developer
understand how to configure these libraries.

> [!TIP] To help your users configure libraries more easily, it is highly recommended that you fill
> out all the properties that the annotation provides, for example:

-

```java
@ExternalLib(name = "MySQL JDBC Driver",
description = "A JDBC driver that supports connection to the MySQL Database",
nameRegexpMatcher = "(.*)\\.jar",
requiredClassName = "com.mysql.jdbc.Driver",
coordinates = "mysql:mysql-connector-java:5.1.44")
public class MySqlConnectionProvider implements ConnectionProvider<Connection> {
  //
}
```

\+ Note that a Connector can require multiple external libraries. The `@ExternalLib` annotation can
be used many times as needed.

### Properties

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><p><code>name</code></p></td><td><p>true</p></td><td><p>String</p></td><td><p>Friendly name to be displayed in the UI.</p></td></tr><tr><td><p><code>description</code></p></td><td><p>false</p></td><td><p>String</p></td><td><p>Short description of the external library.</p></td></tr><tr><td><p><code>nameRegexpMatcher</code></p></td><td><p>false</p></td><td><p>String</p></td><td><p>Regular expression used to match the name of the library’s file and validate that the library specified by your user is the correct one.</p></td></tr><tr><td><p><code>requiredClassName</code></p></td><td><p>false</p></td><td><p>String</p></td><td><p><em>(Only for Java Libraries)</em> Name of a <code>Class</code> that will be present in the external library. This will be used for validating whether the library specified by your user is the correct one.</p></td></tr><tr><td><p><code>type</code></p></td><td><p>true</p></td><td><p>Enum</p></td><td><div><div><ul><li><p><code>NATIVE</code>: Native library dependency</p></li><li><p><code>JAR</code>: JAR file dependency</p></li><li><p><code>DEPENDENCY</code>: External dependency (for example, an obtained dependency that is specified in the <code>pom.xml</code> if you are using Maven)</p></li></ul></div><div><div data-type="NOTE"><div><p>For custom connectors, all Maven dependencies must be accessible from Anypoint Exchange. Maven dependencies published to private or public repositories are not accessible from Anypoint Exchange.</p></div><div><p>You can publish Maven dependencies before publishing your custom connector by using one of the following options:</p></div><div><ul><li><p>Publish the Maven dependencies on Anypoint Exchange to make them available to your Anypoint Platform organization.</p></li><li><p>Publish the Maven dependencies on the <a href="https://maven.apache.org/repository/guide-central-repository-upload.html">Maven Central repository</a> to make them publicly available.</p></li></ul></div><div><p>You cannot use MuleSoft repositories for publishing.</p></div></div></div></div></td></tr><tr><td><p><code>coordinates</code></p></td><td><p>false</p></td><td><p>String</p></td><td><p>Maven coordinates suggestion that indicates where the required library can be found. They should follow Maven’s convention <code>groupId:artifactId:packaging:classifier:version</code>.</p></td></tr><tr><td><p><code>optional</code></p></td><td><p>false</p></td><td><p>Boolean</p></td><td><p>Indicates whether the library is not required for the Connector or Module to work.</p></td></tr></tbody></table>
