Extgen and Modulegen
Lets Understand about Extgen and Modulegen with example
Extgen
How to create an extension in Hybris?
Ant extgen command can be used to create an extension.
We have to use ant extgen command as below
Navigate to hybris\bin\platform path in command prompt
And use ant extgen command
Provide the required values
Specify the extension template,name of the extension and package name while running this command
Extension template should be any of the existing extension templates which are populated when we run the ant extgen command
This command uses the specified extension template to create the structure of the new extension.
Name of the extension we provide will be added as the name inside the extensioninfo.xml file.
Now observe that new extension has been created inside hybris\bin\custom folder.
Update localextensions.xml
Once we create the new extension we must add it inside localextensions.xml so that hybris will consider this extension during the build.
So add an extension inside localextensions.xml as below
extension name=”payment”
Payment – is the name of the extension.
Make custom extension as Extension Template
We can make our custom extension also as extension template so that it appears in the list of extension templates during ant extgen command
To achieve this , we need to define the below tag in extensioninfo.xml
meta key="extgen-template-extension" value="true"
Adding this enables our extension to appear in the ant extgen command templates list.
Modulegen
Ant modulegen command can be used to create the module.
It creates the set of extensions based on the module template we select.
Generally for B2B and B2C module , it creates 7 extensions which are logically related and grouped.
We have to use ant modulegen command as below
Navigate to hybris\bin\platform path in command prompt
And use ant modulegen command
Specify the module template,name of the module and package name while running this command
Module template should be any of the existing module templates which are populated when we run the ant modulegen command
This command uses the specified module template to create the set of the extensions to the new module.
After the build success, observe the new set of extensions has been created inside hybris\bin\custom\training folder.
After the creation of extensions using modulegen, make sure to update the localextensions.xml file as below
- <extension name='trainingcockpits' />
- <extension name='traininginitialdata' />
- <extension name='trainingstorefront' />
- <extension name='trainingfacades' />
- <extension name='trainingfulfilmentprocess' />
- <extension name='trainingtest' />
- <extension name='trainingcore' />
<extension name='trainingcockpits' /> <extension name='traininginitialdata' /> <extension name='trainingstorefront' /> <extension name='trainingfacades' /> <extension name='trainingfulfilmentprocess' /> <extension name='trainingtest' /> <extension name='trainingcore' />
hey thank you article its really helpfull. but my build is fail.
its say=
BUILD FAILED
C:\hybris\hybris\bin\platform\build.xml:100: The following error occurred while executing this line:
C:\hybris\hybris\bin\platform\resources\ant\modulegen.xml:327: The following error occurred while executing this line:
C:\hybris\hybris\bin\platform\resources\ant\modulegen.xml:333: The following error occurred while executing this line:
C:\hybris\hybris\bin\platform\resources\ant\modulegen.xml:48: extgen.properties in source extension not found! this is not a template!
please help
Hey,
I got same error and Done this step.
whatever present in the custom folder, delete that(yb2bacceleratorstorefront) and delete this same extension which is present in the localextensions.xml also, then start this process.
thanks
Can you help me to write a java code which can run ant modulegen and pass the mane and package to the command.
Thanks in advance.
ant modulegen -Dinput.module=accelerator -Dinput.name=testExtension -Dinput.package=com.sbs -Dinput.template=develop
i run this command but this will give me error like build fail…
Hi,
Good article.
When do we have to go for extension or module? One realtime example would be appreciated.
Thanks in advance:)
Hi KB,
I used modulegen with b2c and after that I added the required addons and extension for b2b, b2b works good, but the b2c websites (apparel or electronics) not work, the browser show the message like “Server error”,any idea?
when i created the custom module by command ant modulegen. Then i didn’t get the jobs folder in my custom core extension?
Hi,
I am trying to create module using ant modulegen command selecting b2baccelerator.
But I am getting two extensions created instead of 7 according to your example here:
could you please let me know what I have done wrong here?
b2baccelerator has only two extensions in the module template. The meta key=”modulegen-name” has a value=”b2baccelerator” in those extensions. Remember that the meta key value can have multiple extension names separated by comma.
For example, extension “yacceleratorcockpits” has three extensions as the
value= “accelerator, b2baccelerator, chinaaccelerator”.
When you use modulegen with b2baccelerator, you get yacceleratorcockpit and yacceleratorfulfilmentprocess only.
If you are trying to generate a customized b2baccelerator, use the following steps:
1. Install b2c_acc recipe
2. module gen with [accelerator] module template
3. Update localextensions.xml with new (7) extensions
4. Add the following b2b related extensions
5. Install the addons to
b2bacceleratoraddon
commerceorgaddon
6. Add the following to local.properties
website.powertools.http=http://powertools.local:9001/
website.powertools.https=https://powertools.local:9002/
7. ant initialize
Did you try running b2b_acc recipe ?
Hi, i have tried doing modulegen as you discussed, but i can see only 2 folders created but not 7.
I have b2b_acc_plus recipe installed and using 6.4.0v.
In wiki , there is a reference how to modulegen in b2b.
https://help.hybris.com/6.4.0/hcd/8acc8a5a86691014a20781b3f738213e.html
If you clearly observe, they are saying to install b2c recipe for this.
So if i install b2c recipe , i am getting 7 folders and i have to add those extensions and addons to get b2b behaviour. I have tried in b2c and it worked,but my question is cant we do this in b2b recipe directly (cant we get 7 folders ) ?
Hi,
You can do it by changing modulegen tag inside extension-info.xml file of those 7 yaccelerator extensions to B2B while doing it for B2B recipe.
Sorry KB, i didnt understand what you mean.
What should i change and where shoould i change ?
I want to work with B2B and i want to do modulegen for B2B
Hi
Can u please help me i am stuck while creating extension
Error while evaluating file ‘C:\hybris007\hybris\config\localextensions.xml’. Extension ‘acceleratorcms’ doesn’t specify a path and no scanned extension was matching the name.
Please do thne needful
Hi Ashwini,
Please check the extension acceleratorcms. extensioninfo.xml would be missing.
Thanks,
Rakesh B
Hi KB,
Thanks for the post. I have a few questions though. So what exactly is the next step in the development process of a website after we have done modulegen? In which extension do we start adding the Ui elements ( logo , nav icons etc)? Do we create a new base store and a new website? Do we have to replace the sample data in “electronicstore” and “apparelstore” extensions? I am very new to this so I am having a hard time understanding just how do we proceed with the developement process after doing modulegen.
I’d be very grateful if you could help me understand. Your blog is amazing btw.
Regards,
Devashish
You need to start adding custom code based on the requirements.
UI related things should be added in storefront extension.
Sample data can be created based on our requirements , sample sites they have given is apparelstore, electronicstore etc.
Yes website, store and other details has to be created if we want a new site
Congrats! I like your blog, it’s very helpful. Do you have any blog that it shows how to create a perspective and adding it into a custom cockpit extension in Hybris? Thanks in advance!
Thank you !!
Not yet added anything on cockpit, will let you know once i add it.
Hi KB,
Very nice blog on hybris.
Can you please give a high level picture on content of each extension
like what is major purpose of extension trainingstorefront and the files its has … Like trainingstorefront has jsps and controller
As all above extensions logically form a eCommerce website so what would be the Flow from one extension to other extension
Sure Sateesh.
I will post on it separately.
Hi KB,
I have gone through your articles its quite interesting…
What are the major difference between Extension, Module(accelerator) and AddOn. Please explain the real time scenario when we go for extension and when we go for accelerator
It would be great if explain in detail about hybris architecture
Thanks Sathya!
we will go for Extension when we want some new reusable functionality to be developed which can be reused by other extensions as well.
Example: Payment related code can be written in a new extension so that multiple sites can reuse the same extension.
we will go for accelerator when we start any eCommerce site development in hybris
Example:we will choose B2C if we want to build functionality for B2C eCommerce site, will choose Telco for telecommunication sites.
Addon is also a reusable component which can be installed on an extension.
I will explain about this in separate article.