一、搭建 maven 工程 FlinkTutorial
    pom.xml文件

    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0"
    3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    5. http://maven.apache.org/xsd/maven-4.0.0.xsd">
    6. <modelVersion>4.0.0</modelVersion>
    7. <groupId>com.atguigu.flink</groupId>
    8. <artifactId>FlinkTutorial</artifactId>
    9. <version>1.0-SNAPSHOT</version>
    10. <dependencies>
    11. <dependency>
    12. <groupId>org.apache.flink</groupId>
    13. <artifactId>flink-scala_2.11</artifactId>
    14. <version>1.7.2</version>
    15. </dependency>
    16. <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-streaming-scala -->
    17. <dependency>
    18. <groupId>org.apache.flink</groupId>
    19. <artifactId>flink-streaming-scala_2.11</artifactId>
    20. <version>1.7.2</version>
    21. </dependency>
    22. </dependencies>
    23. <build>
    24. <plugins>
    25. <!-- 该插件用于将 Scala 代码编译成 class 文件 -->
    26. <plugin>
    27. <groupId>net.alchim31.maven</groupId>
    28. <artifactId>scala-maven-plugin</artifactId>
    29. <version>3.4.6</version>
    30. <executions>
    31. <execution>
    32. <!-- 声明绑定到 maven 的 compile 阶段 -->
    33. <goals>
    34. <goal>testCompile</goal>
    35. </goals>
    36. </execution>
    37. </executions>
    38. </plugin>
    39. <plugin>
    40. <groupId>org.apache.maven.plugins</groupId>
    41. <artifactId>maven-assembly-plugin</artifactId>
    42. <version>3.0.0</version>
    43. <configuration>
    44. <descriptorRefs>
    45. <descriptorRef>jar-with-dependencies</descriptorRef>
    46. </descriptorRefs>
    47. </configuration>
    48. <executions>
    49. <execution>
    50. <id>make-assembly</id>
    51. <phase>package</phase>
    52. <goals>
    53. <goal>single</goal>
    54. </goals>
    55. </execution>
    56. </executions>
    57. </plugin>
    58. </plugins>
    59. </build>
    60. </project>