2015-05-10 26 views
1

我正在尝试使用Maven-Jslint插件检查js代码。但是当我试图执行下面的代码时抛出一个错误。未能执行目标org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint(default-cli)关于项目sample-app

<profiles> 
     <profile> 
      <id>jslint</id> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>jslint-maven-plugin</artifactId> 
         <version>1.0.1</version> 
          <executions> 
          <execution> 
           <id>default-cli</id> 
           <phase>test</phase> 
           <goals> 
            <goal>test</goal> 
           </goals> 
           <configuration> 
            <jar>${jslint.jar}</jar> 
            <options>${jslint.options}</options> 
            <predef>${jslint.predef}</predef> 
            <sourceJsFolder> 
            ${basedir}/src/main/js 
            </sourceJsFolder> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 

错误:

[ERROR] Failed to execute goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint (default-cli) on project sample-app: Execution default-cli of goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint failed: charsetName -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint (default-cli) on project sample-app: Execution default-cli of goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint failed: charsetName 

[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException 

u能中的任何一个,请帮助。 在此先感谢。

回答

0

这是一个老问题,我只是碰到了自己。如果jslint使用错误的编码读取文件,则会发生此错误。尝试指定编码属性并将其设置为utf8请参见下文。

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>jslint-maven-plugin</artifactId> 
    <version>1.0.1</version> 
    <executions> 
     <execution> 
      <id>default-cli</id> 
      <phase>test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      <configuration> 
       <jar>${jslint.jar}</jar> 
       <options>${jslint.options}</options> 
       <predef>${jslint.predef}</predef> 
       <sourceJsFolder> 
       ${basedir}/src/main/js 
       </sourceJsFolder> 

       <!-- Sets the encoding of the js files beign read --> 
       <encoding>utf8</encoding> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 
相关问题