【问题标题】:excluding vendor js files from jslint goal but not the compress goal in yuicompressor-maven-plugin从 jslint 目标中排除供应商 js 文件,但不排除 yuicompressor-maven-plugin 中的 compress 目标
【发布时间】:2013-03-12 14:19:46
【问题描述】:

我的项目中有一些第三方 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 错误。我该如何避免呢? 由于他们是第 3 方,我对修复他们的 jslint 错误/警告不感兴趣,但我仍然希望将它们缩小以用于我的部署目的。

【问题讨论】:

    标签: maven maven-3 yui-compressor


    【解决方案1】:

    在这里找到它:http://alchim.sourceforge.net/yuicompressor-maven-plugin/usage_jslint.html

    我可以让它在 下的 而不是在 中工作

    【讨论】:

      猜你喜欢
      • 2012-09-10
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      • 2019-01-02
      • 2011-08-01
      • 2018-08-13
      • 1970-01-01
      • 2017-04-22
      相关资源
      最近更新 更多