Use Ant Customize command in Hybris

Hybris Logo

1. Overview

In Hybris, there are two types of files and directories :

  • Custom files : The source code that we write, change and commit (eg. custom extensions).
  • Read only files : The binary files that we can’t/shouldn’t change (eg. platform).

However, you may need to replace some read only binary files, eg. customize HMc css style.

To do so, you have to :

  1. Copy the original file that you want to customize inside the ${HYBRIS_CONFIG_DIR}/customize directory.
  2. Update and customize the file.
  3. Run ant customize.

In this article, I will show you how to use ant customize command.

2. Ant customize in action

For example, to customize the CSS style of the HMc, you need to replace the hmc.css file located in the ${HYBRIS_BIN_DIR}/ext-platform-optional/hmc/web/webroot/css directory.

2.1. Copy original file

Copy the hmc.css file inside inside the ${HYBRIS_CONFIG_DIR}/customize.

You have to keep the same folder structure, which mean  ${HYBRIS_CONFIG_DIR}/customize/ext-platform-optional/hmc/web/webroot/css/hmc.css.

2.2. Update/Customize file

For this example, I will change the HMc header color.

/*** ... ***/

.page-header {
   height: 71px;
   background-color: red;
   color: #ffffff;
   vertical-align:top;
   text-align:left;
   white-space:nowrap;
   color: #ffffff;
   font-size: 10px;
}

/*** ... ***/

Update only the block you want to customize and keep the rest of the file.

2.3. Run ant customize

The ant customize command, will replace the customized files with original ones.

Start the Hybris server (run ant all if it’s needed) and see your changes.

Change hmc css style in Hybris

 

4 3 votes
Article Rating
Subscribe
Notify of
guest

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

18 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Nupur Gupta
Nupur Gupta
6 years ago

Hi
But if i want to change some classes of ext-commerce extension and i perform same steps then it will create a problem during git versioning because i cannot push my files present in config folder

Nupur Gupta
Nupur Gupta
Reply to  Mouad EL Fakir
6 years ago

Yeah i agree as i tried it on my local machine.Thank you

Nick
Nick
5 years ago

Hey Mouad!
I am really sorry for the off-topic question, but I haven’t managed to find the answer on the Internet.
The thing is that in the docs it is stated that setting autocreate to false on the item type level should cause build failure in case the item type is a new one.
Let’s say I create my new own type:

The build is successful, which is strange

Thank you in advance!

Nick
Nick
Reply to  Mouad EL Fakir
5 years ago

Such a rapid response!
Thank you a lot, Mouad!
Guess they should have mentioned that minor detail in the specs though

Nupur Gupta
Nupur Gupta
5 years ago

Hi Mouad,

I have a question on above post, let suppose i need to customise some UI for browser area of csmcockpit by adding some new buttons and functionality let say big customisation then it will involve lots of file changes from different dependant extension and to copy them in config is it recommendable.

Main thing is , is it recommendable to do big customisations?

Thanks in advance

Mohamed BELMAHI
Reply to  Nupur Gupta
4 years ago

in my opinion, it’s not recommended to do something like this.
Even if it’s possible to do this will be a hard work on such deprecated extension.

Ritesh Suklal Chaudhari
Ritesh Suklal Chaudhari
4 years ago

how to override a file which is in Addon ???

Mohamed BELMAHI
Reply to  Ritesh Suklal Chaudhari
4 years ago

the addon is installed into your web extension, so you can customize its code on your web extension
after been installed, no need of ant customize for this type of request.

Nick
Nick
4 years ago

Is there any way to restore the original state of the file after having called the “customize” target?

Nick
Nick
Reply to  Mouad EL Fakir
4 years ago

Hm, maybe I missed smth, cause it looked like it did not restore after ‘clean’
will double check – thank you a lot!

Aleksandr
Aleksandr
Reply to  Nick
2 years ago

I have the same problem. ‘ant clean’ doesn’t restore original state. Did you resolve it?

Tim
Tim
4 years ago

How to revert the changes back to original? I tried removing the my changes in customize folder and running ant clean all, ant customize, but then also, it is not working.

No I am not able to revert back to original like OTB

arati
arati
2 years ago

I need to replace log4j core jar form platform but unable to do using ant customize.Can you suggest way

Nupur Gupta
Nupur Gupta
2 years ago

Hii,

Need to perform ant customize for Hybris v 2005. Is it possible?
I tried doing the same steps but it creates a duplicate folder instead of overriding.

18
0
Would love your thoughts, please comment.x
()
x