开发者

Can't click on jslint errors in NetBeans

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:

  1. Make NetBeans better at decoding Ant output.
  2. Add an emacsmode option to maven-antrun-plugin.
  3. 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.


The easiest way is to add this plug-in. Supports the Netbeans 7.3.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜