Extensions in SAP Commerce [Hybris]
In this article, I will explain in details about the extensions in SAP Commerce and demonstrate how to create our own custom extension using ant extgen command.
SAP Commerce has a modular architecture, where new business logic is developed in a separate, function specific modules called extensions.
Extension in SAP Commerce is very similar to project in Java.
An extension contains business logic, type definitions, back-office configurations and some configuration files like xml, properties and etc.
SAP Commerce ships with a number of template extensions and we can use ant extgen for generating new extensions based on these template extensions.
Every extension in Hybris contains one important file called extensioninfo.xml file which contains information about extension name, extension module and its dependencies.
To make any custom as template extension using below meta tag:
<meta key=’extgen-template-extension’ value=’true’/>
Create a New Extension:
Creating a new extension means start developing our own SAP Commerce functionalities. We can use yempty template for our custom extension as shown below:
Step1: Navigate into the platform folder:
Step2: Run the setantenv command to configure the Ant build tool:
Step3: Run the ant extgen to create a new extension, with name mycustomextesnion and package com.hybris.training:
ant extgen -Dinput.template="yempty" -Dinput.name="mycustomextension" -Dinput.package="com.hybris.training"
Note: We can also run ant extgen command and then select yempty as template extension and enter package name.
Step4: Add your newly created extension in localextensions.xml file.
Step5: Run ant all from the hybris/platform folder.
Step6: Start Hybris server.
Now we can start implementing our custom login in the newly created custom extension as per business requirement.
If you have any questions or need further clarification on any of the steps, feel free to reach out to me at rameshvanka8@gmail.com. I’m happy to help and would love to hear your feedback!
Comments
Post a Comment