2

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.

Patan
  • 17,073
  • 36
  • 124
  • 198

2 Answers2

3

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.

Alex Objelean
  • 3,893
  • 2
  • 27
  • 36
  • Thank you for the response. Would there be any result if I change it to latest version. – Patan Jul 19 '13 at 07:12
  • All the changes from latest release are described in release notes: https://code.google.com/p/wro4j/wiki/ReleaseNotes Even if you would upgrade to latest version, it wouldn't fix the performance issue as long as you are using slow processors. However, there is one more trick: add the following configuration property to wro.properties: parallelPreprocessing=true (false by default). This feature is experimental, so if you notice any problems - let me know. Could you also post the content of your wro.properties file? – Alex Objelean Jul 19 '13 at 08:08
  • I have added the parallelPreprocessing as true. I will post my wro4j.properties. Let me know if I can improve this. – Patan Jul 19 '13 at 10:36
  • Please let me know if I can any property to make its performance better. – Patan Jul 19 '13 at 10:39
  • I believe you are using rhino based processors (which are usually quite slow). If that is true, you should know that most rhino based processors have a similar node based processor (example: nodeLessCss, nodeCoffeeScript) which are much faster. Try to switch from rhino to node based processors. You must be aware that you have to install node.js on your machine and the npm required to run the processor before using the node based processor. – Alex Objelean Jul 19 '13 at 13:52
1

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.

darniz
  • 21
  • 4