wro4j-maven-plugin slow performance

1.9k Views Asked by At

We are using wro4j maven plugin to process css. we have so much css and the wro processing at build time almost takes 10~20 minutes.

If I use maven parallel option it is reduced to 8 mins.

I still want to reduce its build time as effective as possible.

Is there any better way to process only the files that have changed.

My sample pom.xml file is

    <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

If some one has tried this let me know.

2

There are 2 best solutions below

5
On BEST ANSWER

Here is the answer to your question: https://code.google.com/p/wro4j/wiki/IsWro4jSlow

For some of the slow processors there is an alternative, like less4j instead of rhinoLessCss.

There is one more trick: add the following configuration property to wro.properties:

parallelPreprocessing=true 

This flag is false by default. Be aware that this feature is experimental, so use it with care. If you notice any problems, report about it on project page issue tracker.

It worth mentioning that a newer version of wro4j is available - 1.7.0, which contains few improvements and updates.

2
On

We are having issue at post processer level since our post process has uglifyJs which takes lots of time. is there any flag to enable parallel processing at post processor level or at group level. i cant see any configuration flag for them.

Also is there a way to set this parallel processing condition in the plugin itself rather than setting it in properties file

We are using version 1.5.0

Any advice.