如何通过modulegen在hybris(> 5.7)中创建b2c telco店面?我尝试过使用install.bat -r b2ctelco,但扩展名不是在bin内的自定义文件夹中创建的。
谢谢, 穆拉利
答案 0 :(得分:1)
这里有具体说明: https://help.hybris.com/6.0.0/hcd/f7bd6e3caca1412bb8ceb462145ba14d.html
我复制了下面的要点:
导航到$ {HYBRIS_BIN_DIR} / platform目录。
通过打开setantenv.bat(Windows)或设置您的ant环境。 ./setantenv.sh(Linux / Mac)文件。
运行ant clean并选择默认的[development]环境。
运行ant modulegen命令并调整input.name和input.package参数:
modulegen调用
ant modulegen -Dinput.module=accelerator -Dinput.name=b2ctelcotrail -Dinput.package=de.hybris.b2ctelcotrail -Dinput.template=develop
注意强>
在本文档中,b2ctelcotrail变量用于各种场所,代码和命令。如果您决定另一个变量,请确保使用它。
使用三个第一个参数配置modulegen任务以使用加速器模块,在新扩展名前面加上input.name值,并使用input.package值定义默认Java包前缀。最后一个参数input.template定义为使用hybris的默认配置。 验证控制台中的Ant输出。验证任务是否成功完成,并列出后续步骤。
注意强>
不要按照后续步骤说明进行操作,因为稍后调用的安装程序会覆盖localextensions.xml文件。
修改安装程序配方:
默认情况下,安装程序配方使用标准的yaccelerator模板扩展。要使用新创建的扩展,您需要先修改b2c_telco配方:
使用文本编辑器打开{HYBRIS_HOME} /installer/recipes/b2c_telco/build.gradle文件。 将所有出现的yaccelerator替换为b2ctelcotrail(或您使用的前缀)并保存文件。这样,安装程序在创建localextensions.xml文件时使用新创建的扩展而不是yaccelerator模板扩展,并在新的b2ctelcotrailstorefront上安装b2ctelco插件。下面,您可以在编辑之前和之后找到示例配方。
注意强>
根据您的版本,实际安装脚本可能会略有不同。请务必使用Commerce Suite随附的脚本,不要复制以下示例中的内容。
之前:HYBRIS_HOME / installer / recipes / b2c_telco / build.gradle
apply plugin: 'installer-platform-plugin'
apply plugin: 'installer-addon-plugin'
apply plugin: 'installer-coreplus-plugin'
def config = {
localProperties {
property 'subscription.client.endpoint.uri', 'http://localhost:9001/hybris-cis-mock-subscription-web/sub/cisSubscriptionMock'
property 'persistence.engine.mongodb.databaseName', 'entitlements'
property 'cis.client.subscription.mock', 'false'
property 'kernel.events.cluster.jgroups.channel', 'disable'
property 'datahub.publication.saveImpex', ''
property 'commerceservices.default.desktop.ui.experience', 'desktop'
property 'kernel.autoInitMode', 'update'
}
extensions {
extensions {
extName 'acceleratorcms'
extName 'addonsupport'
extName 'b2ctelcocheckoutaddon'
extName 'b2ctelcocockpits'
extName 'b2ctelcostore'
extName 'b2ctelcostorefront'
extName 'cissubscription'
extName 'cissubscriptionatddtests'
extName 'commercesearchbackoffice'
extName 'commerceservicesbackoffice'
extName 'emsclient'
extName 'emsui'
extName 'entitlementstorefront'
extName 'entitlementatddtests'
extName 'mcc'
extName 'solrfacetsearchbackoffice'
extName 'solrserver'
extName 'configurablebundleatddtests'
extName 'subscriptionstorefront'
extName 'subscriptionatddtests'
extName 'subscriptionserviceshmc'
extName 'subscriptionbackoffice'
extName 'yacceleratorstorefront'
extName 'yacceleratorcockpits'
extName 'yacceleratorfulfilmentprocess'
extName 'yacceleratorcore'
extName 'customersupportbackoffice'
}
webApp {
contextRoot 'entitlements-web'
path '${HYBRIS_BIN_DIR}/../../hybris-ems/binary/entitlements-web.war'
}
webApp {
contextRoot 'hybris-cis-mock-subscription-web'
path '${HYBRIS_BIN_DIR}/../../hybris-sbg/binary/hybris-cis-mock-subscription-web.war'
}
}
}
def pl = platformFactory.createPlatform config
void modifySubscriptioncockpitsRequiredExtensions() {
def extensioninfoFile = "${suiteHome}/hybris/bin/ext-commerce/subscriptioncockpits/extensioninfo.xml"
def root = new XmlParser().parse(extensioninfoFile)
def required = root.extension[0].children()
def dependency = required.find { node -> node.@name == 'yacceleratorcockpits'}
if(dependency == null) {
def node = new Node(null, 'requires-extension', [name: 'yacceleratorcockpits'])
required.add(0, node)
new XmlNodePrinter(new PrintWriter(new FileWriter(extensioninfoFile))).print(root)
}
}
task setup << {
modifySubscriptioncockpitsRequiredExtensions()
pl.setup()
pl.project.addons {
names "b2ctelcostorefront,b2ctelcocheckoutaddon"
b2c "yacceleratorstorefront"
platform pl
}
pl.project.addons {
names "entitlementstorefront"
b2c "yacceleratorstorefront"
platform pl
}
pl.project.addons {
names 'subscriptionstorefront'
b2c 'yacceleratorstorefront'
platform pl
}
copy {
from "${installerHome}/recipes/b2c_telco/logback.xml"
into "${suiteHome}/hybris/bin/platform/tomcat/lib"
}
copy {
from "${installerHome}/recipes/b2c_telco/sbg_properties"
into "${suiteHome}/hybris/bin/platform/tomcat/lib"
exclude "**/*.txt"
}
}
ext {
host = "http://localhost:9001"
contextRoot = "entitlements-web"
tenant = "single"
config = {
localProperties {
properties(
'tomcat.generaloptions': '-Xmx3096M',
'standalone.javaoptions': '-Xmx3040M'
)
}
}
}
task initialize << {
pl.build()
pl.initialize()
}
task start << {
pl.startInBackground()
}
task stop << {
pl.stopInBackground()
之后:HYBRIS_HOME / installer / recipes / b2c_telco / build.gradle
apply plugin: 'installer-platform-plugin'
apply plugin: 'installer-addon-plugin'
apply plugin: 'installer-coreplus-plugin'
def config = {
localProperties {
property 'subscription.client.endpoint.uri', 'http://localhost:9001/hybris-cis-mock-subscription-web/sub/cisSubscriptionMock'
property 'persistence.engine.mongodb.databaseName', 'entitlements'
property 'cis.client.subscription.mock', 'false'
property 'kernel.events.cluster.jgroups.channel', 'disable'
property 'datahub.publication.saveImpex', ''
property 'commerceservices.default.desktop.ui.experience', 'desktop'
property 'kernel.autoInitMode', 'update'
}
extensions {
extensions {
extName 'acceleratorcms'
extName 'addonsupport'
extName 'b2ctelcocheckoutaddon'
extName 'b2ctelcocockpits'
extName 'b2ctelcostore'
extName 'b2ctelcostorefront'
extName 'cissubscription'
extName 'cissubscriptionatddtests'
extName 'commercesearchbackoffice'
extName 'commerceservicesbackoffice'
extName 'emsclient'
extName 'emsui'
extName 'entitlementstorefront'
extName 'entitlementatddtests'
extName 'mcc'
extName 'solrfacetsearchbackoffice'
extName 'solrserver'
extName 'configurablebundleatddtests'
extName 'subscriptionstorefront'
extName 'subscriptionatddtests'
extName 'subscriptionserviceshmc'
extName 'subscriptionbackoffice'
extName 'b2ctelcotrailstorefront'
extName 'b2ctelcotrailcockpits'
extName 'b2ctelcotrailfulfilmentprocess'
extName 'b2ctelcotrailcore'
extName 'customersupportbackoffice'
}
webApp {
contextRoot 'entitlements-web'
path '${HYBRIS_BIN_DIR}/../../hybris-ems/binary/entitlements-web.war'
}
webApp {
contextRoot 'hybris-cis-mock-subscription-web'
path '${HYBRIS_BIN_DIR}/../../hybris-sbg/binary/hybris-cis-mock-subscription-web.war'
}
}
}
def pl = platformFactory.createPlatform config
void modifySubscriptioncockpitsRequiredExtensions() {
def extensioninfoFile = "${suiteHome}/hybris/bin/ext-commerce/subscriptioncockpits/extensioninfo.xml"
def root = new XmlParser().parse(extensioninfoFile)
def required = root.extension[0].children()
def dependency = required.find { node -> node.@name == 'b2ctelcotrailcockpits'}
if(dependency == null) {
def node = new Node(null, 'requires-extension', [name: 'b2ctelcotrailcockpits'])
required.add(0, node)
new XmlNodePrinter(new PrintWriter(new FileWriter(extensioninfoFile))).print(root)
}
}
task setup << {
modifySubscriptioncockpitsRequiredExtensions()
pl.setup()
pl.project.addons {
names "b2ctelcostorefront,b2ctelcocheckoutaddon"
b2c "b2ctelcotrailstorefront"
platform pl
}
pl.project.addons {
names "entitlementstorefront"
b2c "b2ctelcotrailstorefront"
platform pl
}
pl.project.addons {
names 'subscriptionstorefront'
b2c 'b2ctelcotrailstorefront'
platform pl
}
copy {
from "${installerHome}/recipes/b2c_telco/logback.xml"
into "${suiteHome}/hybris/bin/platform/tomcat/lib"
}
copy {
from "${installerHome}/recipes/b2c_telco/sbg_properties"
into "${suiteHome}/hybris/bin/platform/tomcat/lib"
exclude "**/*.txt"
}
}
ext {
host = "http://localhost:9001"
contextRoot = "entitlements-web"
tenant = "single"
config = {
localProperties {
properties(
'tomcat.generaloptions': '-Xmx3096M',
'standalone.javaoptions': '-Xmx3040M'
)
}
}
}
task initialize << {
pl.build()
pl.initialize()
}
task start << {
pl.startInBackground()
}
task stop << {
pl.stopInBackground()
}
运行修改后的安装程序脚本
导航到{HYBRIS_HOME} / installer目录。 使用b2c_telco配方调用安装程序:
WINDOWS: install.bat -r b2c_telco
UNIX: ./install.sh -r b2c_telco
安装脚本使用新创建的b2ctelcotrail扩展创建新的localextensions.xml文件,并将B2C Telco所需的插件安装到新的b2ctelcotrailstorefront扩展中。 检查您的{HYBRIS_HOME} /hybris/config/localextensions.xml文件,并验证它是否包含b2ctelcotrail扩展而不是yaccelerator模板扩展。 您还需要进行以下更改,以便您的Telco站点正确启动。
在文件 /b2ctelcostorefront/resources/b2ctelcostorefront/web/spring/b2ctelcostorefront-web-spring.xml 中,您需要更改条目
<bean id="logoutSuccessHandler" class="de.hybris.platform.yacceleratorstorefront.security.StorefrontLogoutSuccessHandler">
为:
<bean id="logoutSuccessHandler" class="de.hybris.b2ctelcotrail.storefront.security.StorefrontLogoutSuccessHandler">
这是为了克服构建过程中的一个已知错误,该错误将在即时版本中修复。
还有一些步骤(最好查看维基以获取更多详细信息),但这应该有助于解决最初的问题。
希望这有帮助, 塞巴斯蒂安