maven - wro4j-maven-plugin 性能缓慢

标签 maven wro4j

我们正在使用 wro4j maven 插件来处理 css。我们有太多的 css,构建时的 wro 处理几乎需要 10~20 分钟。

如果我使用 Maven 并行选项,时间会减少到 8 分钟。

我仍然希望尽可能有效地减少其构建时间。

有没有更好的方法来只处理已更改的文件。

我的示例 pom.xml 文件是

    <plugin>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-maven-plugin</artifactId>
            <version>1.6.3</version>
            <executions>
                <execution>
                    <id>manage-assets</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>                     <targetGroups>myapp${minifier.suffix},myapp.head${minifier.suffix},myapp.tail${minifier.suffix},myapp.compfurniture.head${minifier.suffix},myapp.compfurniture.tail${minifier.suffix},myapp.compfurniture${minifier.suffix},myapp.compfurniture.oldie${minifier.suffix},myapp.oldie${minifier.suffix},myapp.public${minifier.suffix}</targetGroups> 
                        <minimize>true</minimize>
                        <ignoreMissingResources>false</ignoreMissingResources>                          
                        <contextFolder>${assets.folder.aggregate}</contextFolder>                           <destinationFolder>${assets.folder.aggregate}</destinationFolder>                           <cssDestinationFolder>${assets.folder.aggregate}/css</cssDestinationFolder>                         <jsDestinationFolder>${assets.folder.aggregate}/js</jsDestinationFolder>                                                                        
                        <wroFile>${project.build.directory}/wro4j/wro.xml</wroFile>
                        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
                        <extraConfigFile>${project.build.directory}/wro4j/wro.properties</extraConfigFile>                          <groupNameMappingFile>${project.build.directory}/wro4j/wro-namingstrategy.properties</groupNameMappingFile>                                     
                    </configuration>
                </execution>
            </executions>           
        </plugin>

wro4j.properties

preProcessors=cssImport,semicolonAppender 
postProcessors=lessCss,cssMinJawr,jsMin
parallelPreprocessing=true

如果有人尝试过请告诉我。

最佳答案

这是您问题的答案:https://code.google.com/p/wro4j/wiki/IsWro4jSlow

对于一些速度较慢的处理器,有一个替代方案,例如 less4j 而不是 rhinoLessCss。

还有一个技巧:将以下配置属性添加到 wro.properties:

parallelPreprocessing=true 

该标志默认为 false。请注意,此功能尚处于实验阶段,因此请谨慎使用。如果您发现任何问题,请在项目页面问题跟踪器上报告。

值得一提的是,wro4j 的新版本已推出 - 1.7.0,其中包含一些改进和更新。

关于maven - wro4j-maven-plugin 性能缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17738809/

相关文章:

java - java tomcat应用程序的Maven项目配置

java maven项目结构重构

java - 如何在 Spring 应用程序中获取 wro4j 的 WroModel

java - 为什么 wro4j 找不到我的 main.less 文件?

css - wro4j 通配符不适用于类路径?

maven - bootstrap 3.1.0 的 wro4j less 处理失败

debugging - wro4j——如何在 Debug模式下禁用聚合功能?

java - 无法加载类“org.slf4j.impl.StaticLoggerBinder

java - 由于来自单元测试的日志文件,Jenkins Maven 发布失败

java - 如何使用已标记为已提供的项目的依赖项?