Maven YUI 压缩器插件导致进程资源阶段无法运行?

发布于 2024-10-10 00:31:33 字数 1641 浏览 0 评论 0原文

我有一个构建 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情仇皆在手 2024-10-17 00:31:33

发生的情况是 YUI 压缩器插件将资源目录作为隐式压缩包含的位置之一。它在资源插件执行后运行,用空文件覆盖资源目录中的 xml 和 .properties 文件(因为 xml 和 .properties 文件不包含 javascript)。我的解决方法是向插件的配置中添加新的排除:

  <excludes>
                    <exclude>**/*.xml</exclude> <!-- <-- this one here -->
                    <exclude>**/*.properties</exclude> <!-- <-- and this one -->
                    <exclude>**/extjs*/**/*.js</exclude>
                    <exclude>**/extjs*/**/*.css</exclude>
                </excludes>

但是,这仍然不太理想,因为任何没有 xml 或 .properties 后缀的资源仍将由 yui 压缩器解析;我又回到原来的问题了。

我尝试了这个排除,但它不起作用:

<exclude>**/resources/*.*</exclude>

有谁知道为什么上面的方法不起作用,或者知道如何告诉 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:

  <excludes>
                    <exclude>**/*.xml</exclude> <!-- <-- this one here -->
                    <exclude>**/*.properties</exclude> <!-- <-- and this one -->
                    <exclude>**/extjs*/**/*.js</exclude>
                    <exclude>**/extjs*/**/*.css</exclude>
                </excludes>

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:

<exclude>**/resources/*.*</exclude>

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文