- <build>
- <defaultGoal>compile</defaultGoal>
- <sourceDirectory>${basedir}/src</sourceDirectory>
- <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
- <resources>
- <resource>
- <directory>${basedir}/src</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webappDirectory>${basedir}/WebRoot</webappDirectory>
- <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.1</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <!-- 指定测试文件路径-->
- <testSourceDirectory>${basedir}/src</testSourceDirectory>
- <testClassesDirectory>${basedir}/WebRoot/WEB-INF/classes</testClassesDirectory>
- <skip>false</skip>
- <testFailureIgnore>true</testFailureIgnore>
- <!--
- <properties>
- <property>
- <name>usedefaultlisteners</name>
- <value>false</value>
- </property>
- <property>
- <name>listener</name>
- <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
- </property>
- </properties>
- -->
- </configuration>
- </plugin>
- <plugin>
- <!-- Extended Maven antrun plugin -->
- <!-- https://maven-antrun-extended-plugin.dev.java.net/ -->
- <!-- 将junit生成的xml文件转成html -->
- <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
- <artifactId>maven-antrun-extended-plugin</artifactId>
- <executions>
- <execution>
- <id>test-reports</id>
- <phase>test</phase>
- <configuration>
- <tasks>
- <junitreport todir="${basedir}/target/surefire-reports">
- <fileset dir="${basedir}/target/surefire-reports">
- <include name="**/*.xml" />
- </fileset>
- <report format="noframes" todir="${basedir}/target/surefire-reports" />
- </junitreport>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>1.8.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-trax</artifactId>
- <version>1.8.0</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- <!-- Junit Report plugin -->
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.16</version>
- <configuration>
- <showSuccess>false</showSuccess>
- <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.3</version>
- <configuration>
- <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </reporting>