从maven build-war中排除Test.java类



我试图将src/test/java的一些.java文件排除在maven构建中。我的pom.xml是:

plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
</configuration>
<executions>
   <execution>
    <id>default-testCompile</id>
        <phase>test-compile</phase>
            <configuration>
                   < test Excludes >
                <exclude>**/Test1.java</exclude>
                    <exclude>**/Test2.java</exclude>
                    <exclude>**/Test3.java</exclude>
                    <exclude>**/Test4.java</exclude>
                                <exclude>**/Test5.java</exclude>
                 </testExcludes>
            </configuration> 
                <goals>
              <goal>testCompile</goal>
            </goals>
        </execution>                  
    </executions>
enter code here

但是,当我试图运行从构建中排除的测试类时,会出现ClassNotFoundException。

请引导我。

我添加了以下插件,所以现在跳过测试用例:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
      <version>2.12.2</version>
      <configuration>
        <skipTests>true</skipTests>
      </configuration>
</plugin>

最新更新