Speed up build time of Hybris version 6.x

Hybris Logo

1. Overview

You may have noticed that the build time of Hybris version 6.x using ant all command becomes a little bit slower than the previous versions of Hybris.

In Hybris 6.x, Grunt take a very big part of the build time to compile smartEdit extensions (js, sass…).

[echo] building extension 'cmssmartedit'...
...
Running grunt packageSkipTests
[exec] ←[4mRunning "jshint:all" (jshint) task←[24m
[exec] ←[32m>> ←[39m437 files lint free.
...

I think that Grunt takes from 40% to 50% of the total building time.

So in this article, I will show you how to speed up the build time of Hybris by preventing Grunt from being executed.

2. Config

I didn’t find a legitimate way to prevent Grunt from being executed in Hybris yet.

You may exclude smartEdit extensions from localextensions.xml for example, but personally I prefer to keep it.

So the proposition bellow is just a hack! 🙂

So inside \hybris\bin\ext-content\npmancillary\resources\ant\windows.properties I change the value of loc.NPM_HOME to any arbitrary value, for example :

#loc.NPM_HOME=${ext.npmancillary.path}\\resources\\npm
loc.NPM_HOME=NOT SET
...

The loc.NPM_HOME is used inside \hybris\bin\ext-content\npmancillary\buildcallbacks.xml.

Before disabling Grunt :

BUILD SUCCESSFUL
Total time: 2 minutes 47 seconds

After disabling Grunt :

BUILD SUCCESSFUL
Total time: 1 minute 12 seconds

Note that you don’t want to disable Grunt permanently !

 

4
Leave a Reply

avatar
3 Comment threads
1 Thread replies
2 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
DavidMouad EL Fakirravi Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
ravi
Guest
ravi

Hi Mouad, I am a beginner of the hybris and your articles are very nice. I am trying to reduce my hybris 6.2 build time and followed your mentioned steps but the build throws the error when issuing ant all/ant clean all command. please help me. Please let me know if anything wrong in my steps. Error: BUILD FAILED D:\learn\HYBRISCOMM62\hybris\bin\platform\build.xml:22: The following error occurred while executing this line: D:\learn\HYBRISCOMM62\hybris\bin\platform\resources\ant\compiling.xml:88: The following error occurred while executing this line: D:\learn\HYBRISCOMM62\hybris\bin\platform\resources\ant\compiling.xml:124: The following error occurred while executing this line: D:\learn\HYBRISCOMM62\hybris\bin\platform\resources\ant\util.xml:51: The following error occurred while executing this line: D:\learn\HYBRISCOMM62\hybris\bin\platform\resources\ant\util.xml:53: The following error occurred… Read more »

ravi
Guest
ravi

Hi Mouad,
It’s working… Thanks a lot.

David
Guest
David

That setting does not appear to work for v1811