2011-03-06 48 views
4

我想通過使用maven的配置文件來忽略特定目錄中的一些生成錯誤。我試圖像下面這樣做,但它不起作用。任何幫助將不勝感激?如何覆蓋maven-compiler-plugin的配置。 (建立目錄,我想通過使用配置文件來更改)

============================================ 
[executed command] 

mvn -P test clean compile 

============================================ 
[part of pom.xml] 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.5</source> 
       <target>1.5</target> 
       <showWarnings>true</showWarnings> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<profiles> 
    <profile> 
     <id>test</id> 
     <build> 
      <plugins> 
       <plugin> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <configuration> 
         <source>1.5</source> 
         <target>1.5</target> 
        </configuration> 
        <executions> 
         <execution> 
          <id>default-compile</id> 
          <configuration> 
           <excludes> 
            <exclude>**/nocompile/*</exclude> 
           </excludes> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </build> 
    </profile> 
</profiles> 

============================================ 
[a class happened a build error] 

package com.sample.web.nocompile; 

public class NoCompileSample { 

    // An error do happen here 
    private String 

} 

回答

4

您的個人資料看起來不錯。儘管maven編譯器似乎有一個已知的問題。請參閱this answer以解決問題和解決方法的類似問題。