【发布时间】:2023-03-08 11:34:01
【问题描述】:
如何通过 modulegen 在 hybris (>5.7) 中创建 b2c 电信店面?我试过 install.bat -r b2ctelco,但扩展不是在 bin 内的自定义文件夹中创建的。
谢谢, 壁画
【问题讨论】:
标签: hybris
如何通过 modulegen 在 hybris (>5.7) 中创建 b2c 电信店面?我试过 install.bat -r b2ctelco,但扩展不是在 bin 内的自定义文件夹中创建的。
谢谢, 壁画
【问题讨论】:
标签: hybris
这里有具体的说明: https://help.hybris.com/6.0.0/hcd/f7bd6e3caca1412bb8ceb462145ba14d.html
我复制了以下要点:
导航到 ${HYBRIS_BIN_DIR}/platform 目录。
通过打开 setantenv.bat (Windows) 或 . ./setantenv.sh (Linux/Mac) 文件。
运行ant clean,选择默认的[开发]环境。
运行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">
这是为了克服构建过程中的一个已知错误,该错误将在即将发布的版本中修复。
还有几个步骤(因此最好查看 wiki 了解更多详细信息),但这应该有助于解决最初的问题。
希望这会有所帮助, 塞巴斯蒂安
【讨论】: