Tuesday, February 21, 2017

New Addon creation in Hybris

Steps for creating a new addon
Run ant extgen
Select yaddon as the template and provide a name (name should be followed by word ‘addon’. Eg: testaddon)
Give the package name (eg: org.test)
Add on will be created, and follow the below steps
Add the entry to the localextensions.xml file
Copy testaddon-web-spring.xml from web/webroot/WEB-INF to resources\testaddon\web\spring\testaddon-web-spring.xml to resolve classpath issue
Rename the project.properties in the custom/testaddon directory to project.properties.template
Add the following line to the project.properties.template files
tpinkstorefront.additionalWebSpringConfigs.testaddon=classpath:/ testaddon /web/spring/ testaddon -web-spring.xml
Add/Uncomment the entry if it is already not there
Run the below command to install add on to storefront(let the storefront extension name be samplestorefront )
ant addoninstall -Daddonnames="testaddon" -DaddonStorefront.yacceleratorstorefront="samplestorefront"
This will create an entry of the addon, in the extensioninfo.xml of samplestorefront
Ant clean all, and restart server

Instructions to copy files that need modification to new addon
All the front end related files (controllers, constants, jsps, tag files etc) that need modification related to a particular functionality will go inside the path “testaddon\acceleratoraddon” inside respective folders, and will be copied to samplestorefront after a build
All other files to be modified (facades and services)will go inside the path “testaddon\src” folder
In case of moving jsp/tag files from samplestorefront to addon, we should move any file including these jsp files also to addon and give the new path created in samplestorefront for the included files
Add addonsupport extension , and any other dependent extensions, in extension info for new addon, and also in eclipse, and correct build errors of the new files copied
Remove the entry of any unwanted add-on from extensioninfo.xml of samplestorefront for removing the reference to old addons
For redirecting to the new controllers copied in addon(over writing), we need to give entry in resources\testaddon\web\spring\testaddon-web-spring.xml
For redefining beans, need to give entries in resources\testaddon-spring.xml

No comments:

Post a Comment