本文使用 hybris 5.7版
https://wiki.hybris.com/display/accdoc50to56/Creating+AddOns
一、创建addon
方案一、
/hybris/bin/platform
执行 ant extgen 命令
执行之后如出现下面的错误请参考这里(没有请忽略):
BUILD FAILED
/Code/hybris/bin/platform/build.xml:20: The following error occurred while executing this line:
/Code/hybris/bin/platform/resources/ant/antmacros.xml:159: XXXXX.webroot '/rest' is already used by extension 'ycommercewebservices'!
需要去/Code/lining/Code/hybris/bin/ext-template/ycommercewebservices/extensioninfo.xml
<!-- 注释掉下面三段话 重新 ant extgen 命令-->
<webmodule jspcompile="false" webroot="/rest"/>
<meta key="extgen-template-extension" value="true"/>
<meta key="modulegen-name" value="commercewebservices"/>
选择模板
yaddon
输入name
testaddon
输入package
com.b2c.testaddon
方案二、
/hybris/bin/platform 执行下面命令
ant -Dinput.template=yaddon -Dinput.name=testaddon -Dinput.package=com.b2c.testaddon
二、使用addon
在localextentions.xml 中添加以下代码:
<extension name="testaddon" />
/hybris/bin/platform
ant addoninstall -Daddonnames="testaddon" -DaddonStorefront.ychinaacceleratorstorefront="chinatrailstorefront"