无法下载源(NullPointerException)
每当 m2eclipse 插件想要下载 Maven 依赖项的源文件时,我都会收到以下错误:
java.lang.NullPointerException
at org.eclipse.m2e.jdt.internal.BuildPathManager.attachSourcesAndJavadoc(BuildPathManager.java:845)
at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.run(DownloadSourcesJob.java:165)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
你知道问题可能是什么吗?
根据 源代码 问题似乎出在这一行:
cp[i] = JavaCore.newLibraryEntry(entry.getPath(), srcPath, null, entry.getAccessRules(), //
attributes.toArray(new IClasspathAttribute[attributes.size()]), //
entry.isExported());
我正在将新的 Eclipse Indigo 与当前的 Maven 版本一起使用。
Whenever the m2eclipse plugin wants to download the source files of a Maven dependency I'm getting the following error:
java.lang.NullPointerException
at org.eclipse.m2e.jdt.internal.BuildPathManager.attachSourcesAndJavadoc(BuildPathManager.java:845)
at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.run(DownloadSourcesJob.java:165)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Do you know what the problem could be?
According to the source code the problem seems to be in this line:
cp[i] = JavaCore.newLibraryEntry(entry.getPath(), srcPath, null, entry.getAccessRules(), //
attributes.toArray(new IClasspathAttribute[attributes.size()]), //
entry.isExported());
I'm using the new Eclipse Indigo with the current Maven version.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信我遇到了具有类似症状但完全不同原因的问题,其中条目的 getPath() 返回 null。
如果您在“首选项... Maven”中打开调试输出,我怀疑您会看到路径。
如果它只是一个 jar,您可以检查依赖项的 pom,然后检查源 jar 是否在它应该在的位置。当然,它不应该像这样爆炸,但是奇怪的事情发生了。
I believe I ran into a problem with a similar symptom, but totally different cause, where the entry's getPath() was returning null.
If you turn on debug output in Preferences... Maven, I suspect you'll be shown the path.
If it's just one jar, you might check the dependency's pom and then check to see if the source jar is where it should be. It shouldn't blow up like this, of course, but stranger things have happened.