<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--<compiler-plugin.version>2.3.2</compiler-plugin.version>-->
<compiler-plugin.version>3.5.1</compiler-plugin.version>
<thrift.version>0.9.3</thrift.version>
<avro.version>1.7.7</avro.version>
</properties>
<dependencies>
<!--thrift-->
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>${thrift.version}</version>
</dependency>
<!--avro-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<!--<version>1.6.4</version>-->
<version>1.7.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-ipc</artifactId>
<version>${avro.version}</version>
</dependency>
<!--protobuf-->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--maven-compiler-plugin 编译配置-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-Xlint:none</compilerArgument>
<compilerArguments>
<extdirs>libs</extdirs> <!--使用项目中的jar包-->
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- <uriEncoding>UTF-8</uriEncoding> -->
<port>8080</port>
<!-- <path>/${project.build.finalName}</path>-->
<!-- <path>/</path> -->
</configuration>
</plugin>
<!--maven-surefire-plugin 单元测试 默认绑定到test阶段-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skipTests>true</skipTests>
<skip>true</skip>
</configuration>
</plugin>
<!--maven-jar-plugin 打jar包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<excludes> <!--打包时要排除的文件-->
<exclude>agent.properties</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!-- <classpathPrefix>lib/</classpathPrefix> -->
<mainClass>com.demo.HelloWorld</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!--maven-assembly-plugin 打包含依赖的全包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!--maven-shade-plugin 打包含依赖的全包且可以配置主类-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.xun.pf.sayHello.HelloWorld</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<!--maven-war-plugin 打war包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warName>${project.artifactId}</warName>
<webResources>
<resource> <!--将额外的jar依赖打入war包-->
<directory>libs/</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<!--maven-source-plugin 打包源码-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!--maven-exec-plugin 执行程序-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.demo.config.DocMapper</mainClass>
<arguments>
<argument>${project.build.outputDirectory}\doc-path-map.txt</argument>
<argument>${basedir}\src</argument>
<argument>**/resource/*.java</argument>
</arguments>
</configuration>
</plugin>
<!--maven-dependency-plugin 依赖分析-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive> <!--是否排除间接依赖的包-->
<stripVersion>true</stripVersion> <!--复制的jar文件是否去掉版本信息-->
</configuration>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<!--maven-idea-plugin 生成IntelliJ IDEA工程文件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<jdkName>1.6</jdkName>
<jdkLevel>6.0</jdkLevel>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<dependenciesAsLibraries>true</dependenciesAsLibraries>
<useFullNames>false</useFullNames>
<deploymentDescriptorFile>src/main/webapp/WEB-INF/web.xml</deploymentDescriptorFile>
</configuration>
</plugin>
<!--maven-jetty-plugin jetty服务器-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<excludes>
<exclude>**/*.jsp</exclude>
</excludes>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
<filename>target/yyyy_mm_dd.request.log</filename>
<retainDays>90</retainDays>
<append>true</append>
<extended>false</extended>
<logTimeZone>GMT</logTimeZone>
</requestLog>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>80</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
<!--mybatis-generator-maven-plugin 生成mybatis映射-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedPlugins>
<!-- will only display a warning but does not fail the build. -->
<level>WARN</level>
<excludes>
<exclude>org.apache.maven.plugins:maven-verifier-plugin</exclude>
</excludes>
<message>Please consider using the maven-invoker-plugin
(http://maven.apache.org/plugins/maven-invoker-plugin/)!
</message>
</bannedPlugins>
<requireMavenVersion>
<version>2.0.6</version>
</requireMavenVersion>
<requireJavaVersion>
<version>1.5</version>
</requireJavaVersion>
<requireOS>
<family>unix</family>
</requireOS>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<!--thrift plugin-->
<plugin>
<groupId>org.apache.thrift.tools</groupId>
<artifactId>maven-thrift-plugin</artifactId>
<version>0.1.11</version>
<configuration>
<thriftExecutable>/usr/local/bin/thrift</thriftExecutable>
</configuration>
<executions>
<execution>
<id>thrift-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>thrift-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<!--avro plugin-->
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
</execution>
</executions>
</plugin>
<!--protobuf-->
<plugin>
<groupId>com.github.igor-petruk.protobuf</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.5</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<protocCommand>/usr/local/bin/protoc</protocCommand>
</configuration>
</plugin>
<!--protobuf 2生命周期绑定在generate-sources下,只要执行maven generate-sources就可以了-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>compile-protoc</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="src/main/gen-java"/>
<path id="proto.path">
<fileset dir="src/main/proto">
<include name="**/*.proto"/>
</fileset>
</path>
<pathconvert pathsep=" " property="proto.files"
refid="proto.path"/>
<exec executable="protoc">
<arg value="--java_out=src/main/gen-java"/>
<arg value="-I${project.basedir}/src/main/protobuf"/>
<arg line="src/avro/user.proto"/>
</exec>
</tasks>
<sourceRoot>src/main/gen-java</sourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<verbose>true</verbose>
<filesets>
<fileset>
<directory>src/main/gen-java</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!--maven-resources-plugin 文件资源配置-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding> <!--配置资源文件编码-->
</configuration>
<executions>
<execution>
<id>copy-xmls</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>