apache flink 无法解析导入

huangapple go评论70阅读模式
英文:

apache flink not able to resolve imports

问题

嗨,我正在学习 Flink 的介绍,但是我无法正确导入以下这些包:

    import org.apache.flink.streaming.api.datastream.DataStream;
    import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
    import org.apache.flink.walkthrough.common.sink.AlertSink;
    import org.apache.flink.walkthrough.common.entity.Alert;
    import org.apache.flink.walkthrough.common.entity.Transaction;
    import org.apache.flink.walkthrough.common.source.TransactionSource;

上述的这些包无法导入。
我是从这个链接 
[1] 上获取的信息。
在这个链接中,我通过 mvn 命令导入了项目。 请帮我解决这个问题。 [1]: https://ci.apache.org/projects/flink/flink-docs-release-1.11/try-flink/datastream_api.html
英文:

Hi iam working on the flink introduction but iam not able to import properly

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.walkthrough.common.sink.AlertSink;
import org.apache.flink.walkthrough.common.entity.Alert;
import org.apache.flink.walkthrough.common.entity.Transaction;
import org.apache.flink.walkthrough.common.source.TransactionSource;

these above packages are not able to import
i have used from the following site link

in this link i have imported the project via mvn command

please help me resolve this

答案1

得分: 2

在我的IDE(IntelliJ)中尝试后,我发现要想运行该应用程序,我必须在“Run / Edit Configurations”下选择“包括具有“Provided”范围的依赖项”选项。一旦我这样做了,一切都正常工作了。

apache flink 无法解析导入

我能够在命令行中构建该应用程序(通过“mvn clean package”)而不需要进行任何更改。

英文:

I just tried this myself, and found that in order to run the application in my IDE (IntelliJ) I had to select the option under Run / Edit Configurations to 'Include dependencies with "Provided" scope'. Once I did that, everything worked fine.

apache flink 无法解析导入

I was able to build the application from the command line (via "mvn clean package") without making any changes.

答案2

得分: 0

请您验证一下在您的 Maven pom.xml 文件中的以下构件:

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-java_2.12</artifactId>
    <version>1.11.0</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-walkthrough-table-java</artifactId>
    <version>1.11.1</version>
</dependency>
英文:

Can you please verify the below artifact in your maven pom.xml?

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
    &lt;artifactId&gt;flink-streaming-java_2.12&lt;/artifactId&gt;
    &lt;version&gt;1.11.0&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
    &lt;artifactId&gt;flink-walkthrough-table-java&lt;/artifactId&gt;
    &lt;version&gt;1.11.1&lt;/version&gt;
&lt;/dependency&gt;

huangapple
  • 本文由 发表于 2020年8月31日 00:21:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/63659566.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定