Flink1.12 builds on Mac

We recently compiled Flink 1.12 to summarize the problems encountered

Compile the source code

The process follows Apache Flink 1.12 Documentation: Building Flink from Source.

  1. Make sure you have the JDK and Maven installed

    • Install Java8

      brew cask install adoptopenjdk/openjdk/adoptopenjdk8
      Copy the code
    • Install Maven

      brew install maven
      Copy the code
  2. Follow the tutorial on the official website

    To clone from git, enter:

    git clone https://github.com/apache/flink
    Copy the code

    The simplest way of building Flink is by running:

    mvn clean install -DskipTests
    Copy the code

    This instructs Maven (mvn) to first remove all existing builds (clean) and then create a new Flink binary (install).

    To speed up the build you can skip tests, QA plugins, and JavaDocs:

    mvn clean install -DskipTests -Dfast
    Copy the code

Some possible pits

After Installation, when WordCount is tested in accordance with Apache Flink 1.12 Documentation: Local Installation, the test program will generally report an error if port 8081, the default port used by the Flink UI, is occupied by another process such as a firewall. At this time, you need to set the port:

Open the flink-conf.yaml file and change the rest.port value to 8082, for example.

Restart Flink Cluster to run WordCount properly