An extension is a file containing programming that serves to extend the capabilities of a more basic program. In hybris an extension can contain business logic, type definitions, a web application, or a Hybris Management Console configuration. In simple words, the programming that we add to the basic program is called an extension.
Creating an extension in Hybris:
Open the hybris directory and type CMD in the folder path to open the command prompt using files path.
Run the command “setantenv.bat”.
Run the command “ant extgen” in the command prompt and press enter.
It will ask you for the extension name and type any name as the extension name and press enter. (Here in this case “MYEXTENSION” is the name of the extension ).
Then you will get a BUILD SUCCESS message. You will get some instructions telling you to add the extension created in the local extension file in <HYBRIS_BIN_DIR> /config/localextensions.xml. This is to replicate your created extension in Hybris console.
A folder with your extension name will be added in the <HYBRIS_BIN_DIR> \hybris\bin\custom.
Now add your extension to the xml file in the path <HYBRIS_BIN_DIR> /config/localextensions.xml as shown below
Now make sure you closed the application server and run SETANTENV.BAT command in command prompt and start hybris server by using the command HYBRISSERVER.BAT.
After the server has started, open Hybris administration console (https://localhost:9002/) and give the credentials and click on login.
Go to extensions and search for the extension you have created.
The extension created here is a dummy extension and do not contain any code and purely to let you people know how we can add an extension.