1

我试图将 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。

请指导我..

4

1 回答 1

-1

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

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
      <version>2.12.2</version>
      <configuration>
        <skipTests>true</skipTests>
      </configuration>
</plugin>
于 2013-08-01T08:43:49.713 回答