找不到依赖

来源:2-2 Flink Streaming程序开发-Scala

慕雪3103829

2021-04-26 13:29

大大,那个依赖文件在哪

写回答 关注

1回答

  • 徐老师
    2021-04-30 12:32:06
    已采纳

    pom.xml文件吗?

    我把这个文件的内容贴出来一下:

    这个是Hadoop代码需要用到的

    <dependencies>
    
    <!-- hadoop的依赖 -->
    <dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-client</artifactId>
    <version>3.2.0</version>
    <!-- provided表示这个依赖只在编译的时候,执行或者打jar包的时候都不使用 -->
    <!--<scope>provided</scope>-->
    </dependency>
    
    <!-- log4j的依赖 -->
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.10</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.10</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    </dependencies>
    
    <build>
    <plugins>
    <!-- compiler插件, 设定JDK版本 -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
    <encoding>UTF-8</encoding>
    <source>1.8</source>
    <target>1.8</target>
    <showWarnings>true</showWarnings>
    </configuration>
    </plugin>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <archive>
    <manifest>
    <mainClass></mainClass>
    </manifest>
    </archive>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>


    下面这个是flink代码需要用到的。

    <dependencies>
    
    <dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-java</artifactId>
    <version>1.11.1</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-java_2.12</artifactId>
    <version>1.11.1</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-scala_2.12</artifactId>
    <version>1.11.1</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-scala_2.12</artifactId>
    <version>1.11.1</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-clients_2.12</artifactId>
    <version>1.11.1</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <!-- log4j的依赖 -->
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.10</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.10</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    <dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-client</artifactId>
    <version>3.2.0</version>
    <!--<scope>provided</scope>-->
    </dependency>
    
    </dependencies>
    <build>
    <plugins>
    <!-- 编译插件 -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.6.0</version>
    <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>
    <!-- scala编译插件 -->
    <plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>3.1.6</version>
    <configuration>
    <scalaCompatVersion>2.12</scalaCompatVersion>
    <scalaVersion>2.12.11</scalaVersion>
    <encoding>UTF-8</encoding>
    </configuration>
    <executions>
    <execution>
    <id>compile-scala</id>
    <phase>compile</phase>
    <goals>
    <goal>add-source</goal>
    <goal>compile</goal>
    </goals>
    </execution>
    <execution>
    <id>test-compile-scala</id>
    <phase>test-compile</phase>
    <goals>
    <goal>add-source</goal>
    <goal>testCompile</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    <!-- 打jar包插件(会包含所有依赖) -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.6</version>
    <configuration>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <archive>
    <manifest>
    <!-- 可以设置jar包的入口类(可选) -->
    <mainClass></mainClass>
    </manifest>
    </archive>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>


3小时开启大数据之门

对大数据感兴趣的同学,这门课程将为你揭开迷雾

391 学习 · 4 问题

查看课程

相似问题