Skip to content

Commit

Permalink
[FLINK-26054][build] Add enforcer rule to forbid direct dependency on…
Browse files Browse the repository at this point in the history
… table planner
  • Loading branch information
slinkydeveloper committed Feb 11, 2022
1 parent edcf27a commit 6b6d167
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 10 deletions.
14 changes: 6 additions & 8 deletions flink-connectors/flink-connector-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,6 @@ under the License.
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<!-- Test dependencies -->

Expand Down Expand Up @@ -201,6 +193,12 @@ under the License.
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>cassandra</artifactId>
Expand Down
17 changes: 17 additions & 0 deletions flink-connectors/flink-connector-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,23 @@ under the License.

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>forbid-direct-table-planner-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<!-- We need to depend on table planner because we rely on its internals -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions flink-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,16 @@ under the License.
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>forbid-direct-table-planner-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<!-- We need to depend on table planner to ship it in the /opt folder -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>

Expand Down
17 changes: 17 additions & 0 deletions flink-examples/flink-examples-table/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ under the License.

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>forbid-direct-table-planner-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<!-- See comment above on table planner dependency -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>

<!-- Fail compilation on deprecation warnings to prevent from showing users outdated examples. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
20 changes: 18 additions & 2 deletions flink-table/flink-table-planner-loader-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
</parent>

<artifactId>flink-table-planner-loader-bundle</artifactId>
<name>Flink : Table : Planner Loader Helper</name>
<name>Flink : Table : Planner Loader Bundle</name>
<packaging>jar</packaging>
<description>Intermediate build artifact use by the planner-loader.</description>
<description>Intermediate build artifact used by the flink-table-planner-loader.</description>

<dependencies>
<dependency>
Expand All @@ -46,6 +46,22 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>forbid-direct-table-planner-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,28 @@ under the License.
</rules>
</configuration>
</execution>
<execution>
<id>forbid-direct-table-planner-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>org.apache.flink:flink-table-planner_${scala.binary.version}</exclude>
</excludes>
<includes>
<include>org.apache.flink:flink-table-planner_${scala.binary.version}:*:*:test</include>
</includes>
<message>
Direct dependencies on flink-table-planner are not allowed.
You should depend on either Table API modules or flink-table-planner-loader.
</message>
</bannedDependencies>
</rules>
</configuration>
</execution>
<execution>
<id>dependency-convergence</id>
<!-- disabled by default as it interacts badly with shade-plugin -->
Expand Down

0 comments on commit 6b6d167

Please sign in to comment.