Missing Dependencies in Eclipse IDE with Flink Quickstart

一笑奈何 提交于 2019-12-25 03:12:08

问题


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();

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.


回答1:


I got this working in Eclipse by selecting the add-dependencies-for-IDEA maven profile.

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>

and then created a Maven Build run configuration with

Goals: org.codehaus.mojo:exec-maven-plugin:java
Profiles: add-dependencies-for-IDEA


来源:https://stackoverflow.com/questions/50608571/missing-dependencies-in-eclipse-ide-with-flink-quickstart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!