maven-compiler-plugin排除

eas*_*der 15 maven-2 compilation

我有以下问题.我想在测试 - 编译阶段排除一些.java文件(**/jsfunit/*.java),另一方面我希望在编译阶段包含它们(id我用tomcat启动tomcat:运行目标)

我的pom.xml

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                 <!-- <excludes>
                     <exclude>**/*JSFIntegration*.java</exclude>
                 </excludes> -->                    
            </configuration>
           <executions>
           <!-- <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                          <goal>compile</goal>
                        </goals>
                        <configuration>
                            <includes>
                                 <include>**/jsfunit/*.java</include>
                            </includes>
                        </configuration>
               </execution>-->
              <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <excludes>
                                <exclude>**/jsfunit/*.java</exclude>
                            </excludes>
                        </configuration> 
                        <goals>

                <goal>testCompile</goal>
                        </goals>
                </execution>                  
             </executions>

        </plugin>
Run Code Online (Sandbox Code Playgroud)

但它不起作用:default-testCompile中的exclude不会过滤这些类.如果我删除了注释,那么所有匹配的类**/jsfunit/*.java都会被编译,但只有触摸它们!

sam*_*ert 30

要从default-testCompile阶段排除文件,必须使用<testExcludes>.所以上面的例子看起来像这样:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
  </configuration>
  <executions>
    <execution>
      <id>default-testCompile</id>
      <phase>test-compile</phase>
      <configuration>
        <testExcludes>
          <exclude>**/jsfunit/*.java</exclude>
        </testExcludes>
      </configuration> 
      <goals>
        <goal>testCompile</goal>
      </goals>
    </execution>                  
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)