1. <build>
  2. <defaultGoal>compile</defaultGoal>
  3. <sourceDirectory>${basedir}/src</sourceDirectory>
  4. <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
  5. <resources>
  6. <resource>
  7. <directory>${basedir}/src</directory>
  8. <excludes>
  9. <exclude>**/*.java</exclude>
  10. </excludes>
  11. </resource>
  12. </resources>
  13. <plugins>
  14. <plugin>
  15. <artifactId>maven-war-plugin</artifactId>
  16. <configuration>
  17. <webappDirectory>${basedir}/WebRoot</webappDirectory>
  18. <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
  19. </configuration>
  20. </plugin>
  21. <plugin>
  22. <artifactId>maven-compiler-plugin</artifactId>
  23. <version>2.1</version>
  24. <configuration>
  25. <source>1.6</source>
  26. <target>1.6</target>
  27. </configuration>
  28. </plugin>
  29. <plugin>
  30. <groupId>org.apache.maven.plugins</groupId>
  31. <artifactId>maven-surefire-plugin</artifactId>
  32. <version>2.5</version>
  33. <configuration>
  34. <!-- 指定测试文件路径-->
  35. <testSourceDirectory>${basedir}/src</testSourceDirectory>
  36. <testClassesDirectory>${basedir}/WebRoot/WEB-INF/classes</testClassesDirectory>
  37. <skip>false</skip>
  38. <testFailureIgnore>true</testFailureIgnore>
  39. <!--
  40. <properties>
  41. <property>
  42. <name>usedefaultlisteners</name>
  43. <value>false</value>
  44. </property>
  45. <property>
  46. <name>listener</name>
  47. <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
  48. </property>
  49. </properties>
  50. -->
  51. </configuration>
  52. </plugin>
  53. <plugin>
  54. <!-- Extended Maven antrun plugin -->
  55. <!-- https://maven-antrun-extended-plugin.dev.java.net/ -->
  56. <!-- 将junit生成的xml文件转成html -->
  57. <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
  58. <artifactId>maven-antrun-extended-plugin</artifactId>
  59. <executions>
  60. <execution>
  61. <id>test-reports</id>
  62. <phase>test</phase>
  63. <configuration>
  64. <tasks>
  65. <junitreport todir="${basedir}/target/surefire-reports">
  66. <fileset dir="${basedir}/target/surefire-reports">
  67. <include name="**/*.xml" />
  68. </fileset>
  69. <report format="noframes" todir="${basedir}/target/surefire-reports" />
  70. </junitreport>
  71. </tasks>
  72. </configuration>
  73. <goals>
  74. <goal>run</goal>
  75. </goals>
  76. </execution>
  77. </executions>
  78. <dependencies>
  79. <dependency>
  80. <groupId>org.apache.ant</groupId>
  81. <artifactId>ant-junit</artifactId>
  82. <version>1.8.0</version>
  83. </dependency>
  84. <dependency>
  85. <groupId>org.apache.ant</groupId>
  86. <artifactId>ant-trax</artifactId>
  87. <version>1.8.0</version>
  88. </dependency>
  89. </dependencies>
  90. </plugin>
  91. </plugins>
  92. </build>
  93. <!-- Junit Report plugin -->
  94. <reporting>
  95. <plugins>
  96. <plugin>
  97. <groupId>org.apache.maven.plugins</groupId>
  98. <artifactId>maven-surefire-report-plugin</artifactId>
  99. <version>2.16</version>
  100. <configuration>
  101. <showSuccess>false</showSuccess>
  102. <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
  103. </configuration>
  104. </plugin>
  105. <plugin>
  106. <groupId>org.apache.maven.plugins</groupId>
  107. <artifactId>maven-site-plugin</artifactId>
  108. <version>3.3</version>
  109. <configuration>
  110. <outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
  111. </configuration>
  112. </plugin>
  113. </plugins>
  114. </reporting>
05-22 03:17