【发布时间】: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