This topic explains how to add DataStream connector dependencies to your Maven project and configure them correctly so your Flink jobs can read from and write to external systems.
Prerequisites
Before you begin, ensure that you have:
-
A Maven project using the DataStream API
-
Access to the Maven central repository or a local Maven mirror
-
A VVR engine version selected for your job (determines
${vvr.version}and${flink.version})
For the full list of supported connectors, see Details of supported connectors.
Add connector dependencies to your project
There are two ways to add a connector to your Maven project:
| Method | How it works | When to use |
|---|---|---|
| (Recommended) Upload connector JARs as additional dependencies | Connector JAR is uploaded separately at deployment time; your project JAR stays lean | Default choice for most jobs |
| Package a connector JAR into your project's JAR | Connector is bundled into your project JAR at build time | When you need full control over the dependency classpath or cannot upload additional JARs |
Upload connector JARs as additional dependencies
This method keeps the connector JAR out of your project JAR. You upload it separately when deploying the job.
-
Add the connector dependency to your
pom.xmlwith<scope>provided</scope>:Note${vvr.version}is the Ververica Runtime (VVR) engine version for your job.${flink.version}is the corresponding Apache Flink version.<!-- MySQL connector dependency --> <dependency> <groupId>com.alibaba.ververica</groupId> <artifactId>ververica-connector-mysql</artifactId> <version>${vvr.version}</version> <scope>provided</scope> </dependency>Setting
<scope>provided</scope>tells Maven that the connector JAR will be provided at runtime (uploaded separately) and must not be bundled into your project JAR. Without this setting, at best your project JAR becomes excessively large. At worst, the bundled connector conflicts with the runtime version, causing your job to fail. -
If you are extending a built-in connector or using a custom connector, also add
flink-connector-baseorververica-connector-common:<!-- Base dependency for Apache Flink connector public interfaces --> <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-connector-base</artifactId> <version>${flink.version}</version> </dependency> <!-- Base dependency for Realtime Compute connector public interfaces --> <dependency> <groupId>com.alibaba.ververica</groupId> <artifactId>ververica-connector-common</artifactId> <version>${vvr.version}</version> </dependency> -
Deploy a JAR job. In the Create Jar Deployment dialog box, add the connector JAR to Additional Dependencies. Both custom and built-in connector JARs are supported.

Package a connector JAR into your project's JAR
This method bundles the connector directly into your project JAR. Use the default compile scope — do not set <scope>provided</scope>, because the connector must be packaged into the JAR.
-
Add connector dependencies to your
pom.xml. The following example adds the Kafka and MySQL connectors:Note${vvr.version}is the Ververica Runtime (VVR) engine version for your job.${flink.version}is the corresponding Apache Flink version.<!-- Kafka connector dependency --> <dependency> <groupId>com.alibaba.ververica</groupId> <artifactId>ververica-connector-kafka</artifactId> <version>${vvr.version}</version> </dependency> <!-- MySQL connector dependency --> <dependency> <groupId>com.alibaba.ververica</groupId> <artifactId>ververica-connector-mysql</artifactId> <version>${vvr.version}</version> </dependency> -
If you are extending a built-in connector or using a custom connector, also add
flink-connector-baseorververica-connector-common:<!-- Base dependency for Apache Flink connector public interfaces --> <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-connector-base</artifactId> <version>${flink.version}</version> </dependency> <!-- Base dependency for Realtime Compute connector public interfaces --> <dependency> <groupId>com.alibaba.ververica</groupId> <artifactId>ververica-connector-common</artifactId> <version>${vvr.version}</version> </dependency>
Avoid dependency conflicts
Follow these rules to prevent dependency conflicts.
Flink version consistency
Set ${flink.version} to the Apache Flink version that corresponds to your VVR engine version. For example, if your engine version is vvr-8.0.9-flink-1.17, set ${flink.version} to 1.17.2. Use the latest VVR version when possible. See Engine updates.
Dependency scope for Apache Flink core libraries
Always set <scope>provided</scope> for Apache Flink core dependencies — non-connector dependencies with names starting with flink- in the org.apache.flink group. Without this, the bundled Flink libraries may conflict with the runtime, causing class loading errors or unexpected behavior.
Public API usage
When extending built-in connectors or using custom connectors, only call methods annotated with @Public or @PublicEvolving in the Apache Flink source code. Realtime Compute for Apache Flink guarantees compatibility only for these methods. Calling internal APIs may break your job after an engine upgrade.
Built-in connector APIs
When using Realtime Compute for Apache Flink's built-in connectors, use their supported APIs rather than the equivalent open-source connector methods.