groovy-eclipse-compiler不显示编译器错误

时间:2015-08-21 00:49:50

标签: java eclipse maven groovy

当我进行maven clean安装时,编译失败并且maven报告发生了编译错误。然而,它并没有显示使用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>

maven的输出如下:

[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 个答案:

答案 0 :(得分:1)

添加<showWarnings>true</showWarnings>确实显示了带有编译器错误的类以及一堆其他编译器警告,例如未经检查的转换等,但是错误应该已经显示出来而不必放置它。