无法单击 NetBeans 中的 jslint 错误
我正在尝试配置 NetBeans 构建来调用 jslint 并生成错误,我可以单击这些错误将我带到源代码。
使用 Maven 插件分析 javascript 代码质量中的 Maven 构建脚本,jslint 正在运行并产生错误但我无法点击它们。 NetBeans 输出窗口中的文本如下所示:
[jslint] C:\Documents and Settings\arx\My Documents\Progs\jsweb\src\main\wwwroot\jsweb.js:125:48: 'keydown' is not defined.
I'm running NetBeans 6.9.1 on Windows。路径中的空格不是问题。我用无空间路径尝试过,但仍然不起作用。
最终,我想在 NetBeans 中编辑一个简单的 javascript+html 项目,并且有来自 jslint 的可点击错误。我没有和 Maven 结婚。任何建议都非常感激。
更新:解决方案
如果我将 jslint4java 直接放入 Ant 项目(而不是包装在 Maven 插件中的 Ant 项目),则输出不包含 [jslint] 前缀,我可以单击错误。
这有点麻烦,因为似乎有必要显式列出所有 jar 文件依赖项的位置,但它确实有效。
另一个更新
我正在尝试在 Maven 中进行这项工作,因为它的 Java 依赖管理非常好。问题肯定是输出中的 [jslint] 前缀,它是由 Ant 生成的。
似乎没有任何方法可以让 NetBeans 忽略前缀,这很奇怪,因为 Ant 是 NetBeans 的默认构建工具。
可以通过在 Ant 的 DefaultLogger 上设置 emacsmode 属性来抑制该前缀。 NetBeans 在启动 Ant 时会执行此操作(如果在选项中设置了“build.compiler.emacs=true”),但 maven-antrun-plugin 不会(查看源代码,目前没有任何方法可以说服它)。
可能的修复方法有:
- 使 NetBeans 更好地解码 Ant 输出。
- 向 maven-antrun-plugin 添加 emacsmode 选项。
- 找到一个原生的 Maven jslint 插件(所以根本不使用 Ant)。
选项 3 看起来可能是最简单的,所以我使用 TortoiseSVN 下载 http://mojo.codehaus 的源代码.org/jslint-plugin/ 来自 https://svn. codehaus.org/mojo/trunk/sandbox/jslint-plugin 并让它工作。但它会产生 NetBeans 不友好的输出,例如:
[ERROR]jssvg.js:2690:48:'keydown' is not defined.
I'm trying to configure a NetBeans build to call jslint and produce errors that I can click on to take me to the source.
Using the Maven build script from Maven plugins to analyze javascript code quality, jslint is running and producing errors but I can't click on them. The text in the NetBeans output window looks like this:
[jslint] C:\Documents and Settings\arx\My Documents\Progs\jsweb\src\main\wwwroot\jsweb.js:125:48: 'keydown' is not defined.
I'm running NetBeans 6.9.1 on Windows. The spaces in the path aren't an issue. I tried it with a spaceless path and it still didn't work.
Ultimately I want to edit a simple javascript+html project in NetBeans and have clickable errors from jslint. I'm not wedded to Maven. Any suggestions gratefully received.
Update: A solution
If I put jslint4java directly into an Ant project (rather than an Ant project wrapped in a Maven plugin) the output doesn't include the [jslint] prefix and I can click on the errors.
This is a bit of a chore because it seems to be necessary to explicitly list the locations of all the jar file dependencies, but it works.
Another Update
I'm having another go at making this work in Maven because its java dependency management is nice. The problem is definitely the [jslint] prefix in the output, which is produced by Ant.
There doesn't seems to be any way of making NetBeans ignore the prefix, which is odd because Ant is NetBeans's default build tool.
The prefix can be suppressed by setting the emacsmode property on Ant's DefaultLogger. NetBeans does this when it lauches Ant iself (if "build.compiler.emacs=true" is set in Options), but maven-antrun-plugin doesn't (and looking at the source, there's not currently any way of persuading it to).
Possible fixes are:
- Make NetBeans better at decoding Ant output.
- Add an emacsmode option to maven-antrun-plugin.
- Find a native Maven jslint plugin (so Ant isn't used at all).
Option 3 looked like potentially the simplest so I used TortoiseSVN to download the source for http://mojo.codehaus.org/jslint-plugin/ from https://svn.codehaus.org/mojo/trunk/sandbox/jslint-plugin and got it working. But it produces NetBeans-unfriendly output like:
[ERROR]jssvg.js:2690:48:'keydown' is not defined.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是添加这个插件。支持 Netbeans 7.3。
The easiest way is to add this plug-in. Supports the Netbeans 7.3.