Re: compiling flink job with maven is failing with error: object flink is not a member of package org.apache

Posted by zhangminglei on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/compiling-flink-job-with-maven-is-failing-with-error-object-flink-is-not-a-member-of-package-org-apae-tp21108p21110.html

Hi, Mich.

Is there a basic MVN pom file for flink? The default one from GitHub does not seem to be working!

Please take a look on https://github.com/apache/flink/blob/master/flink-quickstart/flink-quickstart-java/src/main/resources/archetype-resources/pom.xml

Cheers
Minglei


在 2018年7月1日,下午7:44,Mich Talebzadeh <[hidden email]> 写道:

I have done many times with sbt or maven for spark streaming.

Trying to compile a simple program that compiles ok in flink-scala.sh

The imports are as follows
import java.util.Properties
import java.util.Arrays
import org.apache.flink.api.common.functions.MapFunction
import org.apache.flink.api.java.utils.ParameterTool
import org.apache.flink.streaming.api.datastream.DataStream
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer09
import org.apache.flink.streaming.util.serialization.SimpleStringSchema
import org.apache.flink.streaming.util.serialization.DeserializationSchema
import org.apache.flink.streaming.util.serialization.SimpleStringSchema

with adding to classpath the following jars it compiles

flink-connector-kafka-0.9_2.11-1.5.0.jar
flink-connector-kafka-base_2.11-1.5.0.jar

I guess my pom.xml is incorrect.

I have added these two dependencies to the pom.xml file

<dependency>
  <groupId>org.apache.flink</groupId>
  <artifactId>flink-streaming-java_2.11</artifactId>
  <version>1.4.2</version>
  <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-core</artifactId>
    <version>1.5.0</version>
</dependency>


However, I am getting these basic errors!

[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:4: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.api.java.utils.ParameterTool
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:5: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.api.datastream.DataStream
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:6: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:7: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer09
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:8: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.util.serialization.SimpleStringSchema
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:9: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.util.serialization.DeserializationSchema
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:10: error: object flink is not a member of package org.apache
[INFO] import org.apache.flink.streaming.util.serialization.SimpleStringSchema
[INFO]                   ^
[ERROR] /home/hduser/dba/bin/flink/md_streaming/src/main/scala/myPackage/md_streaming.scala:18: error: not found: value StreamExecutionEnvironment
[INFO]     val env = StreamExecutionEnvironment.getExecutionEnvironment


Is there a basic MVN pom file for flink? The default one from GitHub does not seem to be working!

Thanks

Dr Mich Talebzadeh

 

 


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.