Overview
​
Extgen and Modulegen commands assists developers in generating custom extensions and modules for the Commerce platform. These tools simplify the process of creating new components, allowing developers to focus on adding specific functionality to their Commerce applications.
​
Both extgen and modulegen are valuable tools for developers working with SAP Commerce because they streamline the process of creating custom components and extensions, which are essential for tailoring the platform to specific business needs
​
Extgen(Extension Generator)
Extgen is used to generate custom extensions within your SAP Commerce project.
​
Steps to create extension in Hybris :
​
1) Run "ant extgen" from command-line in platform folder.
​
​
​
​
2) Choose a template for generation. Press enter to proceed with yempty.
​
​
​
​
​
3) Choose the name of your extension. Press enter to proceed with default value training.
​
Hw
​
​
4) Choose the package name of your extension. Press enter to proceed with default "org.training".
​
​
​
​
5) Add your extension to your localextensions.xml file.
<extension name="training"/>
6) Perform 'ant' in your hybris/platform directory
7) Restart the applicationserver
​
​
Modulegen (Module Generator)
Modulegen is a command introduced in SAP Commerce Cloud to create modules, which are similar to extensions but offer additional capabilities for cloud-native development. This command creates the set of extensions based on the module template we select.
​
Steps to create module in Hybris :
​
1) Run "ant modulegen" from command-line in platform folder.
​
​
​
​
2) Choose a template for generation. Press enter to proceed with default template "accelerator".
​
​
​
​
3) Choose the name of your module . Press enter to proceed with default name "training".
4) Choose the package name of your module extension. Press enter to proceed with default "org.training".
\\
​
​
​
​
​
​
5) Add newly created extensions to your localextensions.xml file.
<extension name="trainingcore"/>
<extension name="trainingbackoffice"/>
<extension name="trainingfacades"/>
<extension name="trainingfulfilmentprocess"/>
<extension name="traininginitialdata"/>
<extension name="trainingstorefront"/>
<extension name="trainingtest"/>
6) Remove the following extensions from your localextensions.xml
<extension name="yacceleratorcore"/>
<extension name="yacceleratorbackoffice"/>
<extension name="yacceleratorfacades"/>
<extension name="yacceleratorfulfilmentprocess"/>
<extension name="yacceleratorinitialdata"/>
<extension name="yacceleratorstorefront"/>
<extension name="yacceleratortest"/>
7) Perform 'ant' in your hybris/platform directory.
8) Restart the applicationserver.
​
How to add custom extension in Extension Template list.
We can make custom extension as extension template by adding the below tag in the extensioninfo.xml file of the extension. Now while running ant extgen command we can see this custom extension will be added in the extension template list.
​
meta key="extgen-template-extension" value="true"
​
​









