从maven build war中排除Test.java类

时间:2013-07-24 06:07:48

标签: maven

我试图将src / test / java的一些.java文件排除在maven build中。我的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

但是当我尝试运行从构建中排除的Test类时,正在给出ClassNotFoundException。

请指导我..

1 个答案:

答案 0 :(得分:-2)

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

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