maven“不能找到符号”消息无益 [英] maven "cannot find symbol" message unhelpful

查看:308
本文介绍了maven“不能找到符号”消息无益的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个非常简单的问题,它可能是一个我不知道的地方,但Google对这个问题没有帮助,给出了编译错误的结果,而不是如何更改编译错误信息。



当我用maven构建我的项目时,它会给我错误消息格式大致如下:



[ERROR]路径/到/源/ Main.java:[13,8]错误:找不到符号



当我用ant或javac构建时,它在错误消息中找不到。 maven给我一个行号和字符位置,但显示实际的符号将更有帮助。上面的行是为每个can not find symbol错误提供的唯一行。上面或下面没有给出符号的线。我想象有一些方法让maven告诉我这些信息,但我不知道是什么。我尝试了-e选项,因为mvn告诉我尝试使用它,但它给错误的一个maven追溯,而不是实际的符号。



任何帮助? / p>

这是mvn的输出--version

  Apache Maven 3.0。 4(rNON-CANONICAL_2012-10-24_11-25_mockbuild; 2012-10-24 07:25:04-0400)
Maven主页:/ usr / share / maven
Java版本:1.7.0_09-icedtea ,vendor:Oracle Corporation
Java主页:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre
默认语言环境:en_US,平台编码:UTF-8
操作系统名称:linux,版本:3.6.6-1.fc17.x86_64,arch:amd64,family:unix

这里是一个示例(无帮助)的错误消息,正如maven输出(只是缩短目录):

  [INFO] ------------------------------------- ------------------------ 
[错误]编译错误:
[INFO] --------- -------------------------------------------------- -
[ERROR] /path/to/source/SoundEngineFilePanel.java:[33,8]错误:找不到符号
[ERROR] class SoundEngineFilePanel
/ path / to / source / SoundEngineFilePanel.java:[36,8]错误:找不到符号
[INFO] 2错误
[INFO] -------------------- -----------------------------------------

找不到的符号是fakeThing和fakeThing2,而不是SoundEngineFilePanel。

解决方案

这是Maven编译器插件中的错误,相关JDK7我想。使用JDK6可以正常工作。


This is a really simple question, and it's probably a setting somewhere I don't know about, but Google is being particularly unhelpful for this question, giving results about compilation errors, not how to change compilation error messages.

When I build my project with maven, it will give me error messages formatted roughly as follows:

[ERROR] /path/to/source/Main.java:[13,8] error: cannot find symbol

When I build with ant or javac, it will actually tell me the symbol that it can't find in the error message. maven gives me a line number and character position, but displaying the actual symbol would be more helpful. The line above is the only line given for each of the "cannot find symbol" errors. There is no line above or below that gives the symbol. I imagine there has to be some way to get maven to tell me that information, but I don't know what it is. I tried the -e option, as mvn told me to try using it, but it gave a maven traceback for the error, not the actual symbol.

Any help?

Here's the output of mvn --version

Apache Maven 3.0.4 (rNON-CANONICAL_2012-10-24_11-25_mockbuild; 2012-10-24 07:25:04-0400)
Maven home: /usr/share/maven
Java version: 1.7.0_09-icedtea, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.6.6-1.fc17.x86_64", arch: "amd64", family: "unix"

And here's an example (unhelpful) error message, exactly as output by maven (just with directories shortened):

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /path/to/source/SoundEngineFilePanel.java:[33,8] error: cannot find symbol
[ERROR]  class SoundEngineFilePanel
/path/to/source/SoundEngineFilePanel.java:[36,8] error: cannot find symbol
[INFO] 2 errors 
[INFO] -------------------------------------------------------------

The symbols it can't find are "fakeThing" and "fakeThing2", not SoundEngineFilePanel.

解决方案

This is a bug in the Maven compiler plugin, related to JDK7 I think. Works fine with JDK6.

这篇关于maven“不能找到符号”消息无益的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆