Javascript code can be tough to maintain.
I am looking for tools that will help me ensure a reasonable quality level.
So far I have found JsUNit, a very nice unit te
I've used the following code to run JSLint as part of the COMPILE phase in Maven.
It downloads jslint4java from maven repository so you don't need anything else.
If JSLint found problems in javascript files, the build will fail.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef name="jslint" classname="com.googlecode.jslint4java.ant.JSLintTask" classpath="${settings.localRepository}/com/googlecode/jslint4java/jslint4java-ant/1.4.2/jslint4java-ant-1.4.2.jar" />
<jslint options="white,browser,devel,undef,eqeqeq,plusplus,bitwise,regexp,strict,newcap,immed">
<predef>Ext,Utils</predef>
<formatter type="plain" />
<fileset dir="${basedir}/src/main/resources/META-INF/resources/js" includes="**/*.js" />
</jslint>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.googlecode.jslint4java</groupId>
<artifactId>jslint4java-ant</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>
</plugin>
A couple of plugins I've submitted at Codehaus may also be of interest:
http://mojo.codehaus.org/js-import-maven-plugin/
http://mojo.codehaus.org/jslint-maven-plugin/
The first one brings Maven dependency management to JavaScript. The second one allows the rapid and efficient invocation of JSLint.
The new jslint-maven-plugin looks useful. It wraps jslint4java, executing JSLint during the test phase of your build.
A quick Google for "jslint ant task" reveals jslint4java, which apparently includes an Ant task.
This is an old thread, but if you're interested in running Jasmine for BDD testing in your maven project, I wrote this jasmine-maven-plugin for exactly this purpose (that is, improving JS quality by encouraging TDD of it).
http://github.com/searls/jasmine-maven-plugin
jslint4java has been mentioned a few times, I can't recall which version they added it, but there's actually a built in Maven task.
Traditionally with jslint4java and Maven, folks have used the antrun plugin to run the jslint4java ant task, however you can now configure it all in Maven and avoid that extra step.
http://docs.jslint4java.googlecode.com/git/2.0.2/maven.html