2010-06-12 11 views
14

다음과 같은 문제가 있습니다. 테스트 컴파일 단계에서 일부 .java 파일 (**/jsfunit/*. java)을 제외시키고 싶습니다. 컴파일 단계에서이 파일들을 포함시키고 싶습니다. (id는 바람둥이로 tomcat을 시작합니다 : run 목표)maven-compiler-plugin exclude

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

그러나이 작동하지 않습니다 이러한 클래스를 필터링하지 않습니다 기본-testCompile 실행에서 제외합니다. 주석을 제거하면 **/jsfunit/*. java와 일치하는 모든 클래스가 컴파일되지만 컴파일 할 수 있습니다!

+0

('$ {basedir} '과 관련하여) jsfunit 파일의 정확한 경로는 무엇입니까? –

+0

src/main/java/de/hska/repo/ui/jsfunit – easyrider

+1

이해가 안됩니다. 'compiler : testCompile' *는 응용 프로그램 테스트 소스 * (즉,'src/test/main' 아래의 테스트 소스)를 컴파일하므로 제외 할 것이 없습니다. 문제는 정확히 무엇입니까? 무엇을 해결하려고합니까? –

답변

29

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> 
관련 문제