使用 Flink 快速入门在 Eclipse IDE 中缺少依赖项 [英] Missing Dependencies in Eclipse IDE with Flink Quickstart
问题描述
我已经克隆了 Flink Training repo 并按照有关构建和部署的说明进行操作从这里 以熟悉Apache Flink.但是,构建并导入Eclipse IDE后,项目中存在错误.在 Flink Training Exercises
项目中,我发现生命周期配置未涵盖的 pom 插件执行中的错误:net.alchim31.maven:scala-maven-plugin:3.1.4:testCompile
.项目 flink-quickstart-java
也有错误.一些依赖项没有得到解决,例如BatchJob
类中的ExecutionEnvironment 无法解析
.
I have cloned Flink Training repo and followed instructions on building and deploying from here in order to get familiar with Apache Flink. However, there are the errors in the projects after building and importing into Eclipse IDE. In the Flink Training Exercises
project i find errors in the pom Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.4:testCompile
. There are also errors in the project flink-quickstart-java
. Some dependencies are not being resolved e.g. ExecutionEnvironment cannot be resolved
in the BatchJob
class.
public class BatchJob {
public static void main(String[] args) throws Exception {
// set up the batch execution environment
final ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();
我已尝试清理 .m2
文件夹并多次编译/构建这两个项目,但仍然没有任何乐趣!一般来说,我总是遇到 Flink 依赖问题,在 Java 中编程 Flink 有最佳实践吗?我该如何解决这些依赖问题.
I have tried to clean the .m2
folder and complied/built both projects several times but there is no joy yet ! Generally, I always have issues with Flink dependencies, are there best practices on programming Flink in Java? How can I resolve these dependencies issue.
推荐答案
我通过选择 add-dependencies-for-IDEA
maven 配置文件在 Eclipse 中实现了这个功能.
I got this working in Eclipse by selecting the add-dependencies-for-IDEA
maven profile.
我将此部分添加到 <build><插件>在我的 pom 文件中:
I added this section to <build> <plugins> in my pom file:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.apache.flink.flink_quickstart_java.BatchJob</mainClass>
</configuration>
</plugin>
然后用
Goals: org.codehaus.mojo:exec-maven-plugin:java
Profiles: add-dependencies-for-IDEA
这篇关于使用 Flink 快速入门在 Eclipse IDE 中缺少依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!