Maven YUI 压缩器插件导致进程资源阶段无法运行?
我有一个构建 war 文件的 Maven 项目。
在我的 Maven 构建文件中包含 yui 压缩器会导致在 src/main/resources/ 中找到的与任何 js 文件无关的文件,在将进程资源复制到目标目录时处理为空。确实很奇怪。一旦 yuicompressor 插件从循环中删除,其他资源就可以正常处理。
有人见过吗(请说是;-))?
这是我的配置:
YUI 压缩机配置:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/extjs*/**/*.js</exclude>
<exclude>**/extjs*/**/*.css</exclude>
</excludes>
<nosuffix>true</nosuffix>
</configuration>
</plugin>
和资源配置,包含复制到目标目录时为空的文件:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
重复:资源目录中的文件(log4j.xml 等)将被复制到目标目录,但它们是空的。
感谢您的帮助!
I have a maven project that builds a war file.
Including the yui compressor in my maven build file is causing files, found in src/main/resources/ unrelated to any js files, processed during the process-resources to be empty when they are copied into the target directory. Very weird, indeed. Once the yuicompressor plugin is removed from the cycle, the other resources are processed just fine.
Anyone ever seen that (please, say yes ;-) )?
Here's my config:
The YUI Compressor config:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/extjs*/**/*.js</exclude>
<exclude>**/extjs*/**/*.css</exclude>
</excludes>
<nosuffix>true</nosuffix>
</configuration>
</plugin>
And the Resources config, containing the files that are empty when copied into the target dir:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
To repeat: the files (log4j.xml, etc) in the resources directory are being copied over to the target directory, but they are empty.
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发生的情况是 YUI 压缩器插件将资源目录作为隐式压缩包含的位置之一。它在资源插件执行后运行,用空文件覆盖资源目录中的 xml 和 .properties 文件(因为 xml 和 .properties 文件不包含 javascript)。我的解决方法是向插件的配置中添加新的排除:
但是,这仍然不太理想,因为任何没有 xml 或 .properties 后缀的资源仍将由 yui 压缩器解析;我又回到原来的问题了。
我尝试了这个排除,但它不起作用:
有谁知道为什么上面的方法不起作用,或者知道如何告诉 yui 插件不处理资源中的任何内容?
What is happening is the YUI Compressor plugin has the resources directory as one of the locations to include for compressing implicitly. It was being run after the resources plugin executed, overwriting the xml and .properties files in the resources dir with empty files (because xml and .properties files don't contain javascript). My fix was to add new excludes to the plugin's config:
This is still less than ideal, however, because any resources without an xml or .properties suffix will still be parsed by the yui compressor; I'm back to the original problem.
I tried this exclude, but it didn't work:
does anyone have any idea why the above wouldn't work, or have an idea how to tell the yui plugin not to process anything in resources?