传统项目目录结构下maven+junit+junitReport

<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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值