Maven快速构建flink项目骨架(二、IDEA GUI方式)

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第1张图片

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第2张图片

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第3张图片

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第4张图片

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第5张图片

Maven快速构建flink项目骨架(二、IDEA GUI方式)_第6张图片

由于flink骨架快速原型生成的maven dependency 中使用"provided" 约束, 则会因编译部署的时候没有将依赖全部导入,骨架快速原型导入的maven,里面scope好多是provided的,这样导致依赖在编译的时候无法全部加载,生产环境的话如果已经装好了环境,那么这个在生产上跑是没问题的,但是调试的时候需要将这个勾选,否则会报错!

生成好的pom.xml内容如下:


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0modelVersion>

	<groupId>com.andy.flinkgroupId>
	<artifactId>FlinkTutorialScalaartifactId>
	<version>1.0-SNAPSHOTversion>
	<packaging>jarpackaging>

	<name>Flink Quickstart Jobname>

	<repositories>
		<repository>
			<id>apache.snapshotsid>
			<name>Apache Development Snapshot Repositoryname>
			<url>https://repository.apache.org/content/repositories/snapshots/url>
			<releases>
				<enabled>falseenabled>
			releases>
			<snapshots>
				<enabled>trueenabled>
			snapshots>
		repository>
	repositories>

	<properties>
		<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
		<flink.version>1.11.2flink.version>
		<scala.binary.version>2.11scala.binary.version>
		<scala.version>2.11.12scala.version>
		<log4j.version>2.12.1log4j.version>
	properties>

	<dependencies>
		
		
		<dependency>
			<groupId>org.apache.flinkgroupId>
			<artifactId>flink-scala_${scala.binary.version}artifactId>
			<version>${flink.version}version>
			<scope>providedscope>
		dependency>
		<dependency>
			<groupId>org.apache.flinkgroupId>
			<artifactId>flink-streaming-scala_${scala.binary.version}artifactId>
			<version>${flink.version}version>
			<scope>providedscope>
		dependency>
		<dependency>
			<groupId>org.apache.flinkgroupId>
			<artifactId>flink-clients_${scala.binary.version}artifactId>
			<version>${flink.version}version>
			<scope>providedscope>
		dependency>

		
		<dependency>
			<groupId>org.scala-langgroupId>
			<artifactId>scala-libraryartifactId>
			<version>${scala.version}version>
			<scope>providedscope>
		dependency>

		

		

		
		
		<dependency>
			<groupId>org.apache.logging.log4jgroupId>
			<artifactId>log4j-slf4j-implartifactId>
			<version>${log4j.version}version>
			<scope>runtimescope>
		dependency>
		<dependency>
			<groupId>org.apache.logging.log4jgroupId>
			<artifactId>log4j-apiartifactId>
			<version>${log4j.version}version>
			<scope>runtimescope>
		dependency>
		<dependency>
			<groupId>org.apache.logging.log4jgroupId>
			<artifactId>log4j-coreartifactId>
			<version>${log4j.version}version>
			<scope>runtimescope>
		dependency>
	dependencies>

	<build>
		<plugins>
			
			
			<plugin>
				<groupId>org.apache.maven.pluginsgroupId>
				<artifactId>maven-shade-pluginartifactId>
				<version>3.1.1version>
				<executions>
					
					<execution>
						<phase>packagephase>
						<goals>
							<goal>shadegoal>
						goals>
						<configuration>
							<artifactSet>
								<excludes>
									<exclude>org.apache.flink:force-shadingexclude>
									<exclude>com.google.code.findbugs:jsr305exclude>
									<exclude>org.slf4j:*exclude>
									<exclude>org.apache.logging.log4j:*exclude>
								excludes>
							artifactSet>
							<filters>
								<filter>
									
									<artifact>*:*artifact>
									<excludes>
										<exclude>META-INF/*.SFexclude>
										<exclude>META-INF/*.DSAexclude>
										<exclude>META-INF/*.RSAexclude>
									excludes>
								filter>
							filters>
							<transformers>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>com.andy.flink.StreamingJobmainClass>
								transformer>
							transformers>
						configuration>
					execution>
				executions>
			plugin>

			
			<plugin>
				<groupId>org.apache.maven.pluginsgroupId>
				<artifactId>maven-compiler-pluginartifactId>
				<version>3.1version>
				<configuration>
					<source>1.8source>
					<target>1.8target>
				configuration>
			plugin>

			
			<plugin>
				<groupId>net.alchim31.mavengroupId>
				<artifactId>scala-maven-pluginartifactId>
				<version>3.2.2version>
				<executions>
					<execution>
						<goals>
							<goal>compilegoal>
							<goal>testCompilegoal>
						goals>
					execution>
				executions>
				<configuration>
					<args>
						<arg>-nobootcparg>
					args>
				configuration>
			plugin>

			
			<plugin>
				<groupId>org.apache.maven.pluginsgroupId>
				<artifactId>maven-eclipse-pluginartifactId>
				<version>2.8version>
				<configuration>
					<downloadSources>truedownloadSources>
					<projectnatures>
						<projectnature>org.scala-ide.sdt.core.scalanatureprojectnature>
						<projectnature>org.eclipse.jdt.core.javanatureprojectnature>
					projectnatures>
					<buildcommands>
						<buildcommand>org.scala-ide.sdt.core.scalabuilderbuildcommand>
					buildcommands>
					<classpathContainers>
						<classpathContainer>org.scala-ide.sdt.launching.SCALA_CONTAINERclasspathContainer>
						<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINERclasspathContainer>
					classpathContainers>
					<excludes>
						<exclude>org.scala-lang:scala-libraryexclude>
						<exclude>org.scala-lang:scala-compilerexclude>
					excludes>
					<sourceIncludes>
						<sourceInclude>**/*.scalasourceInclude>
						<sourceInclude>**/*.javasourceInclude>
					sourceIncludes>
				configuration>
			plugin>
			<plugin>
				<groupId>org.codehaus.mojogroupId>
				<artifactId>build-helper-maven-pluginartifactId>
				<version>1.7version>
				<executions>
					
					<execution>
						<id>add-sourceid>
						<phase>generate-sourcesphase>
						<goals>
							<goal>add-sourcegoal>
						goals>
						<configuration>
							<sources>
								<source>src/main/scalasource>
							sources>
						configuration>
					execution>
					
					<execution>
						<id>add-test-sourceid>
						<phase>generate-test-sourcesphase>
						<goals>
							<goal>add-test-sourcegoal>
						goals>
						<configuration>
							<sources>
								<source>src/test/scalasource>
							sources>
						configuration>
					execution>
				executions>
			plugin>
		plugins>
	build>
project>

你可能感兴趣的:(Flink,flink)