2

プロジェクトにいくつかのサード パーティの js ファイルがあり、デプロイ時に縮小したいのですが、それらの特定の js ファイルで jslint の警告を表示したくありません。どうすればこれを達成できますか?

両方の目標をリストし、設定で js を除外すると、予想どおり、compress 目標でもそれらが除外されます。

<plugin>
   <groupId>net.alchim31.maven</groupId>
   <artifactId>yuicompressor-maven-plugin</artifactId>
   <executions>
     <execution>
       <goals>
         <goal>compress</goal>
         <goal>jslint</goal>
       </goals>
     </execution>
   </executions>
   <configuration>
     <nosuffix>true</nosuffix>
     <webappDirectory>${project.build.directory}/min</webappDirectory>
     <excludes>
       <exclude>**/*min.js</exclude>
       <exclude>**/*min.css</exclude>
       <exclude>**/ZeroClipboard.js</exclude>
       <exclude>**/TableTools.js</exclude>
       <exclude>**/jquery.dataTables.rowGrouping.js</exclude>
     </excludes>
   </configuration>
 </plugin>

しかし、個々の実行に構成を入れても、jslint は除外された js ファイルからのエラーを表示します。

    <plugin>
      <groupId>net.alchim31.maven</groupId>
      <artifactId>yuicompressor-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>minify</id>
          <phase>package</phase>
          <goals>
            <goal>compress</goal>                    
          </goals>                  
          <configuration>
            <excludes>
              <exclude>**/*.min.js</exclude>
              <exclude>**/*.min.css</exclude>                      
            </excludes>
          </configuration>
        </execution>
        <execution>
          <id>jslint</id>
          <phase>package</phase>
          <goals>
            <goal>jslint</goal>
          </goals>
          <configuration>
            <excludes>
          <exclude>**/ZeroClipboard.js</exclude>
          <exclude>**/TableTools.js</exclude>
          <exclude>**/jquery.dataTables.rowGrouping.js</exclude>
          <exclude>**/*.min.js</exclude>
          <exclude>**/*.min.css</exclude>
        </excludes>
          </configuration>
        </execution>
      </executions>
      <configuration>
        <nosuffix>true</nosuffix>
      </configuration>
    </plugin>

上記のプラグイン構成では、リストされた 3 つの js ファイルからの jslint エラーが引き続き表示されます。どうすればそれを回避できますか? それらはサードパーティであるため、jslint のエラー/警告を修正することに興味はありませんが、展開目的でそれらを縮小したいと考えています。

4

1 に答える 1

0

ここで見つけました:http://alchim.sourceforge.net/yuicompressor-maven-plugin/usage_jslint.html

<execution> 内ではなく <plugin> の下に <configuration> を配置して動作させることができました

于 2014-02-18T15:09:11.413 に答える