@Mojo(name="jshint",
defaultPhase=PROCESS_SOURCES)
public class JSHintMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected File |
baseDirectory
The base directory of the current project
|
protected String |
checkstyleReportFile
The path / name of the checkstyle XML report file to write if any JSHint errors / warnings have been found.
|
protected List<String> |
excludes
The files to explicitly exclude from JSHint validation - this will always override includes
|
protected boolean |
failOnError
Flag to specify if JSHint errors should fail the build
|
protected boolean |
ignoreJSHintConfigFiles
Flag to specify that any
.jshintrc files found in the source directory should be ignored |
protected boolean |
ignoreJSHintIgnoreFiles
Flag to specify that any
.jshintignore files found in the source directory should be ignored |
protected List<String> |
includes
The files to explicitly include in JSHint validation - defaults to all files within the source directory if not set
|
protected String |
jsHintDefaultConfigFile
The default JSHint config file to use for running JSHint validations.
|
protected String |
jshintScript
The path to the JSHint script to use - this path is resolved against the project base directory first and then the classpath of the
plugin including any configured plugin dependencies.
|
protected String |
jshintVersion
The version of the embedded JSHint script to use.
|
protected File |
outputDirectory
The build output directory of the current project
|
protected boolean |
preferRhino
Flag to specify if Rhino should always be used even if Nashorn is available
|
protected boolean |
skip
Flag to specify execution of this mojo should be skipped
|
protected File |
sourceDirectory
The source directory to process
|
| Constructor and Description |
|---|
JSHintMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
protected String |
loadDefaultJSHintConfig() |
protected List<String> |
loadExcludesFromJSHintIgnores() |
protected List<String> |
lookupJavaScriptFilesToInclude() |
void |
setBaseDirectory(File baseDirectory) |
void |
setBaseDirectory(String baseDirectory) |
void |
setCheckstyleReportFile(String checkstyleReportFile) |
void |
setExcludes(List<String> excludes) |
void |
setFailOnError(boolean failOnError) |
void |
setIgnoreJSHintConfigFiles(boolean ignoreJSHintConfigFiles) |
void |
setIgnoreJSHintIgnoreFiles(boolean ignoreJSHintIgnoreFiles) |
void |
setIncludes(List<String> includes) |
void |
setJsHintDefaultConfigFile(String jsHintDefaultConfigFile) |
void |
setJshintScript(String jshintScript) |
void |
setJshintVersion(String jshintVersion) |
void |
setPreferRhino(boolean preferRhino) |
void |
setSkip(boolean skip) |
void |
setSourceDirectory(File sourceDirectory) |
void |
setSourceDirectory(String sourceDirectory) |
protected void |
writeReports(Map<String,List<Error>> errorsByFile) |
@Parameter(defaultValue="${project.basedir}",
property="baseDirectory",
required=true,
readonly=true)
protected File baseDirectory
@Parameter(defaultValue="${project.build.directory}",
property="outputDirectory",
required=true,
readonly=true)
protected File outputDirectory
@Parameter(defaultValue="${project.basedir}/src/main",
property="sourceDirectory",
required=true)
protected File sourceDirectory
@Parameter(defaultValue=".jshintrc",
property="jsHintDefaultConfigFile",
required=true)
protected String jsHintDefaultConfigFile
ignoreJSHintConfigFiles is set to false
this may be overriden by .jshintrc files found in the sourceDirectory. This can be a path that will be resolved
first against the baseDirectory of the current project, falling back on classpath resolution against classpath of the plugin
and its configured dependency.@Parameter(property="includes",
required=false)
protected List<String> includes
@Parameter(property="excludes",
required=false)
protected List<String> excludes
@Parameter(property="failOnError",
required=false)
protected boolean failOnError
@Parameter(property="preferRhino",
required=false)
protected boolean preferRhino
@Parameter(property="ignoreJSHintIgnoreFiles",
required=false)
protected boolean ignoreJSHintIgnoreFiles
.jshintignore files found in the source directory should be ignored@Parameter(property="ignoreJSHintConfigFiles",
required=false)
protected boolean ignoreJSHintConfigFiles
.jshintrc files found in the source directory should be ignored@Parameter(defaultValue="2.9.3",
property="jshintVersion",
required=true)
protected String jshintVersion
jshintScript is set.@Parameter(property="jshintScript",
required=false)
protected String jshintScript
jshintVersion setting.@Parameter(property="checkstyleReportFile",
required=false)
protected String checkstyleReportFile
@Parameter(property="skip",
required=false)
protected boolean skip
public void setBaseDirectory(String baseDirectory)
baseDirectory - the baseDirectory to setpublic void setBaseDirectory(File baseDirectory)
baseDirectory - the baseDirectory to setpublic void setSourceDirectory(String sourceDirectory)
sourceDirectory - the sourceDirectory to setpublic void setSourceDirectory(File sourceDirectory)
sourceDirectory - the sourceDirectory to setpublic void setJsHintDefaultConfigFile(String jsHintDefaultConfigFile)
jsHintDefaultConfigFile - the jsHintDefaultConfigFile to setpublic void setIncludes(List<String> includes)
includes - the includes to setpublic void setExcludes(List<String> excludes)
excludes - the excludes to setpublic void setFailOnError(boolean failOnError)
failOnError - the failOnError to setpublic void setPreferRhino(boolean preferRhino)
preferRhino - the preferRhino to setpublic void setIgnoreJSHintIgnoreFiles(boolean ignoreJSHintIgnoreFiles)
ignoreJSHintIgnoreFiles - the ignoreJSHintIgnoreFiles to setpublic void setIgnoreJSHintConfigFiles(boolean ignoreJSHintConfigFiles)
ignoreJSHintConfigFiles - the ignoreJSHintConfigFiles to setpublic void setJshintVersion(String jshintVersion)
jshintVersion - the jshintVersion to setpublic void setJshintScript(String jshintScript)
jshintScript - the jshintScript to setpublic void setCheckstyleReportFile(String checkstyleReportFile)
checkstyleReportFile - the checkstyleReportFile to setpublic void setSkip(boolean skip)
skip - the skip to setpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected String loadDefaultJSHintConfig()
Copyright © 2016. All rights reserved.