<build>
<finalName>statis-jobs-scala</finalName>
<sourceDirectory>src/main/scala</sourceDirectory>
<resources>
<!-- 排除目录 -->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>conf/dev/**</exclude>
<exclude>conf/test/**</exclude>
<exclude>conf/pro/**</exclude>
</excludes>
</resource>
<!-- 定制开发环境配置文件替换到指定conf目录 -->
<resource>
<directory>src/main/resources/conf/${profiles.active}</directory>
<targetPath>conf</targetPath>
<includes>
<include>*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
<!-- 定制开发环境配置文件替换到src/main/resources目录 -->
<resource>
<directory>src/main/resources/conf/${profiles.active}</directory>
<includes>
<include>core-site.xml</include>
<include>hdfs-site.xml</include>
<include>hive-site.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- 在maven项目中既有java又有scala代码时配置 maven-scala-plugin 插件打包时可以将两类代码一起打包 -->
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- maven 打jar包需要插件 -->
<!-- <plugin>-->
<!-- <artifactId>maven-assembly-plugin</artifactId>-->
<!-- <version>2.4</version>-->
<!-- <configuration>-->
<!-- <!– 设置false后是去掉 MySpark-1.0-SNAPSHOT-jar-with-dependencies.jar 后的 “-jar-with-dependencies” –>-->
<!-- <!–<appendAssemblyId>false</appendAssemblyId>–>-->
<!-- <descriptorRefs>-->
<!-- <descriptorRef>jar-with-dependencies</descriptorRef>-->
<!-- </descriptorRefs>-->
<!-- <archive>-->
<!-- <manifest>-->
<!-- <mainClass>xxxxxxxxxx</mainClass>-->
<!-- </manifest>-->
<!-- </archive>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>make-assembly</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>assembly</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- 以上assembly可以将依赖的包打入到一个jar包中,下面这种方式是使用maven原生的方式打jar包,不将依赖的包打入到最终的jar包中 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!-- 指定当前主类运行时找依赖的jar包时 所有依赖的jar包存放路径的前缀 -->
<!-- <classpathPrefix>/alljars/lib</classpathPrefix>-->
<mainClass>xxxxxxxxxx</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- 拷贝依赖的jar包到lib目录 -->
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-dependency-plugin</artifactId>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>copy</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>copy-dependencies</goal>-->
<!--</goals>-->
<!--<configuration>-->
<!--<outputDirectory>-->
<!--<!– 将依赖的jar 包复制到target/lib下–>-->
<!--${project.build.directory}/lib-->
<!--</outputDirectory>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<!-- 该插件解决java和scala混编时出错的问题 -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</build>