Speed up build time of Hybris version 6.x
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 !
Solution Architect with 10+ years of experience across full-stack development, DevOps, and enterprise software design. Expert in building scalable architectures, CI/CD pipelines, and internal developer platforms using tools like GitHub Actions, Terraform, Kubernetes (AKS), Azure, and Prometheus. Strong hands-on background in Java, Spring, Node.js, and event-driven systems (Kafka, Mulesoft). Passionate about developer experience, software quality, and platform engineering
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 »
I think you need to build your project once using the default configuration, then apply the changes mentioned on the post and run the build again.
Hi Mouad,
It’s working… Thanks a lot.
That setting does not appear to work for v1811
In my case it works well for 1811