2015-08-21 38 views
1

當我做一個maven乾淨安裝,編譯失敗和maven報告發生編譯錯誤。但是它不會顯示使用groovy-eclipse-compiler時發生這種情況的類。該插件的配置是如下:groovy-eclipse-compiler不會顯示編譯器錯誤

<plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <!-- 2.8.0-01 and later require maven-compiler-plugin 3.0 or higher --> 
       <version>3.1</version> 
       <configuration> 
        <!-- Using the groovy-eclipse-compiler plugin because the gmaven plugin doesn't support compilation --> 
        <compilerId>groovy-eclipse-compiler</compilerId> 
        <!-- set verbose to be true if you want lots of uninteresting messages --> 
        <verbose>true</verbose> 
        <source>${jdk.version}</source> 
        <target>${jdk.version}</target> 
        <encoding>ISO-8859-1</encoding> 
       </configuration> 
       <dependencies> 
        <dependency> 
         <artifactId>maven-compiler-plugin</artifactId> 
         <groupId>org.apache.maven.plugins</groupId> 
         <version>3.1</version> 
        </dependency> 
        <dependency> 
         <groupId>org.codehaus.groovy</groupId> 
         <artifactId>groovy-eclipse-compiler</artifactId> 
         <version>2.8.0-01</version> 
        </dependency> 
        <!-- for 2.8.0-01 and later you must have an explicit dependency on 
         groovy-eclipse-batch --> 
        <dependency> 
         <groupId>org.codehaus.groovy</groupId> 
         <artifactId>groovy-eclipse-batch</artifactId> 
         <!-- <version>1.8.6-01</version> --> 
         <!-- or choose a different compiler version --> 
         <version>2.1.5-03</version> 
         <!-- <version>1.7.10-06</version> --> 
        </dependency> 
        <dependency> 
         <groupId>org.codehaus.groovy</groupId> 
         <artifactId>groovy-all</artifactId> 
         <version>${groovy.version}</version> 
        </dependency> 
       </dependencies> 
      </plugin> 

而且從行家的輸出如下:

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject --- 
[INFO] Changes detected - recompiling the module! 
[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files 
[INFO] Classpath: 
[INFO] All args: [] 
[INFO] 17 files left. 
[INFO] 16 files left. 
[INFO] 15 files left. 
[INFO] 14 files left. 
[INFO] 13 files left. 
[INFO] 12 files left. 
[INFO] 11 files left. 
[INFO] 10 files left. 
[INFO] 9 files left. 
[INFO] 8 files left. 
[INFO] 7 files left. 
[INFO] 6 files left. 
[INFO] 5 files left. 
[INFO] 4 files left. 
[INFO] 3 files left. 
[INFO] 2 files left. 
[INFO] 1 file left. 
[INFO] 0 files left. 
[INFO] Compilation complete. Compiled 18 files. 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] Found 1 error and 0 warnings. 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 12.337 s 
[INFO] Finished at: 2015-08-20T17:43:11-07:00 
[INFO] Final Memory: 21M/221M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myproject: Compilation failure 
[ERROR] Found 1 error and 0 warnings. 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

回答

1

添加<showWarnings>true</showWarnings>確實顯示了該編譯器錯誤類與一羣其他編譯器警告這樣的沿作爲未經檢查的轉換等等,但是不應該出現錯誤而應該顯示錯誤。