My Java web app contains java files for the back-end and javascript files for the front-end. I have an ant script that compiles the java code and creates and deploys a war file (which contains the js files and other assets).
Additionally, I would like the ant script to validate that the js has correct syntax. If someone accidentally breaks the js by deleting a curly brace or semicolon, I want to the ant script to tell me.
I’m using Java 7, so Rhino is already available in the jdk.
How would I set up an ant task that uses Rhino to load up a javascript file and return an error code if Rhino was unable to parse the javascript file?
I have had good experience using WRO4J to lint and minify my js resources.
http://code.google.com/p/wro4j/