SAP Hybris commerce ships with an extension generator tool called extgen, which is short for extension generator. Using extgen tool, you can create new extension based on extension templates. With the extgen tool, you can create one new extension using one template extension. From a technical perspective, any extension can be used as a template extension. The extgen tool is fairly basic in that it simply replaces the tokens configured in properties file.
SAP Hybris Commerce installation
Before running the extgen tool, you need to download the latest version of SAP Hybris Commerce.
Once you have downloaded SAP Hybris Commerce, extract the Hybris Commerce ZIP file.
1.Open a command prompt.
2.Navigate to the %HYBRIS_HOME_DIR%/installer directory.
3. Invoke the installer with the b2c_acc recipe by entering the following command.
Steps to create an extension using extgen
1.Navigate to the %HYBRIS_HOME_DIR%/hybris/bin/platform directory
2. Now run setantenv.bat file. Do not close the command prompt.
Extgen prompts you to specify values for the technical aspects of an extension. Extgen comes with default values for all these technical aspects.
These default values are defined in the project.properties file in the extgen directory. The default value is displayed in brackets ([ and ])
Choose a template for generation
Press enter to use the default value. Here default value is [yempty] and we press enter.
Choose the name of extension
Here we specify the name of the extension is hybrisdiary.
Choose the package name
We can choose default package name for our extension but we specify the name of the package is org.bitbyte .
Now observe that new extension(hybrisdiary) has been created inside hybris/bin/custom folder.
Configure localextension.xml file
Add your extension to your X:\%HYBRIS_HOME_DIR%\hybris\config/localextensions.xml. After the creation of extensions using extgen, make sure to update the localextensions.xml file as below