问题
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