2015-05-10 53 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> 
相關問題