The sections below describe how to import the Flink project into an IDE for the development of Flink itself. For writing Flink programs, please refer to the Java API and the Scala API quickstart guides.
NOTE: Whenever something is not working in your IDE, try with the Maven
command line first (mvn clean package -DskipTests
) as it might be your IDE
that has a bug or is not properly set up.
To get started, please first checkout the Flink sources from one of our repositories, e.g.
A brief guide on how to set up IntelliJ IDEA IDE for development of the Flink core. As Eclipse is known to have issues with mixed Scala and Java projects, more and more contributors are migrating to IntelliJ IDEA.
The following documentation describes the steps to setup IntelliJ IDEA 2019.1.3 (https://www.jetbrains.com/idea/download/) with the Flink sources.
The IntelliJ installation setup offers to install the Scala plugin. If it is not installed, follow these instructions before importing Flink to enable support for Scala projects and files:
mvn clean package -DskipTests
also creates the files necessary
for the IDE to work but without installing the libraries.IntelliJ supports checkstyle within the IDE using the Checkstyle-IDEA plugin.
"tools/maven/checkstyle.xml"
within
your repository."suppressions.xml"
, and click “Next”, then “Finish”.Once the plugin is installed you can directly import "tools/maven/checkstyle.xml"
by going to Settings -> Editor -> Code Style -> Java -> Gear Icon next to Scheme dropbox. This will for example automatically adjust the imports layout.
You can scan an entire module by opening the Checkstyle tools window and clicking the “Check Module” button. The scan should report no errors.
Note Some modules are not fully covered by checkstyle,
which include flink-core
, flink-optimizer
, and flink-runtime
.
Nevertheless please make sure that code you add/modify in these modules still conforms to the checkstyle rules.
Enable scalastyle in Intellij by selecting Settings -> Editor -> Inspections, then searching for “Scala style inspections”. Also Place "tools/maven/scalastyle_config.xml"
in the "<root>/.idea"
or "<root>/project"
directory.
NOTE: From our experience, this setup does not work with Flink due to deficiencies of the old Eclipse version bundled with Scala IDE 3.0.3 or due to version incompatibilities with the bundled Scala version in Scala IDE 4.4.1.
We recommend to use IntelliJ instead (see above)
A brief guide on how to set up PyCharm for development of the flink-python module.
The following documentation describes the steps to setup PyCharm 2019.1.3 (https://www.jetbrains.com/pycharm/download/) with the Flink Python sources.
If you are in the PyCharm startup interface:
If you have used PyCharm to open a project:
The Python code checkstyle of Apache Flink should create a flake8 external tool in the project.
Now, you can check your Python code style by the operation: “Right click in any file or folder in the flink-python project -> External Tools -> flake8”