问题
I am using JSHint for my maven project (Executing mvn jshint:lint will display warnings). There are two configuration methods provided on http://www.jshint.com/docs/
Currently i am using the Inline configuration
, but i am interested in using package.json
file which they have mentioned in Configuration
, but i don't know where to put this file.
How to configure the maven project to use package.json
or .jshintrc
config file with jshint?
回答1:
You could create a grunt task which can be called by Maven client to run your jshint stuff. See:
http://addyosmani.com/blog/making-maven-grunt/
回答2:
Here my maven config, maybe it helps:
<build>
<plugins>
<!-- ... -->
<plugin>
<groupId>com.cj.jshintmojo</groupId>
<artifactId>jshint-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<configuration>
<version>2.5.6</version>
<failOnError>false</failOnError>
<configFile>src/main/javascript/jshint.package.json</configFile>
<directories>
<directory>src/main/javascript</directory>
</directories>
<!--<reporter>jslint</reporter><reportFile>target/jslint.xml</reportFile>-->
<!--<reporter>html</reporter><reportFile>target/jshint.html</reportFile>-->
<reporter>checkstyle</reporter>
<reportFile>target/checkstyle-jshint.xml</reportFile>
<failOnError>false</failOnError> <!-- this seems to be ignored -->
</configuration>
<goals>
<goal>lint</goal> <!-- jshint:lint -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
The plugin documentation is quite hard to find. Please try here: https://github.com/cjdev/jshint-mojo
来源:https://stackoverflow.com/questions/24802243/how-to-configure-jshint-with-maven