3. New Extension

动机    

    hybris 商务套房是基于模块化的概念,允许新的逻辑位于单独的函数专用扩展。

    一个扩展是一个封装的 hybris 商务套件可以包含业务逻辑,类型定义,一个 web 应用程序,或者 hybris 管理控制台(hMC)主机配置。      

    扩展这个 hybris 商务套件,您使用现有的扩展可以编写一个定制的扩展,。简而言之,就是 hybris 提供了一个基于ant扩展生成器(extgen),使用一组函数专用扩展模板。

    我们将把 cuppytrail 项目分割成许多扩展分做不同的功能区域,如cockpit定制,hMC,前端开发。

   

3. New Extension_第1张图片

在这一步中,我们将创建一个新的扩展名为cuppytrail并导入新的扩展到Eclipse编译结果。你会发现在Eclipse的扩展是显示为顶级项目包管理器视图。

1 .Eclipse 控制台中 Ant 点开 platform的buid.xml>extgen>选择yempty>输入cuppytrail>输入de.hybris.platform.cuppytrail

    3. New Extension_第2张图片

2.打开 hybris/config/localextensions.xml添加代码

    <extensions>
        ...
        <extension name="cuppytrail"/>
        ...
    </extensions>


3.cmd命令 停止服务  Ctrl+C  输入 y

4.cmd命令 输入ant clean all

5.cmd命令 打开服务 输入hybrisserver

6.Eclipse导入cuppytrail  地址 hybris/bin/custom

7. http://localhost:9001/platform/extensions  查看是否存在  Name=cuppytrail

8.Eclipse打开 cuppytrail>extensioninfo.xml

   注释掉这行代码 <webmodule jspcompile="false" webroot="/cuppytrail"/>

<?xml version="1.0"?>
<!--
 [y] hybris Platform
 
 Copyright (c) 2000-2013 hybris AG
 All rights reserved.
 
 This software is the confidential and proprietary information of hybris
 ("Confidential Information"). You shall not disclose such Confidential
 Information and shall use it only in accordance with the terms of the
 license agreement you entered into with hybris.
 
   
-->
<extensioninfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extensioninfo.xsd">
 
   <extension  name="cuppytrail"
               abstractclassprefix="Generated"
               classprefix="Cuppytrail"
               managername="CuppytrailManager"
               managersuperclass="de.hybris.platform.jalo.extension.Extension"
               >
                
      <!-- you should add all required extensions to this list, except platform extensions which are automatically required -->        
      <!-- <requires-extension name="cms"/> -->        
       
 
      <coremodule    packageroot="de.hybris.platform.cuppytrail"
                    manager="de.hybris.platform.cuppytrail.jalo.CuppytrailManager"
                    generated="true"
                    />
 
      <!--  
      <webmodule jspcompile="false" 
                    webroot="/cuppytrail"
                    />
      -->
 
   </extension>
       
</extensioninfo>


9.cmd命令 停止服务  Ctrl+C  输入 y   

10.cmd命令 输入ant clean all(ant all)

        sidenote构建框架和Eclipse ,我们会多出两个目录

        1) classes, ant 构建生成的类

        2) eclipsebin Eclipse生成构建输出

            3. New Extension_第3张图片            

11. 启动 hybrisserver, 检出是否还有cuppytrail页面http://localhost:9001/cupytrail


PS: ant all  或者 ant clean all 之后,eclipsebin 可能不能及时出现在 eclipse 中, 启动hybrisserver时会出现一些找不到什么什么类,这时请选中所有的 extension F5 刷新他们,之后重新启动






你可能感兴趣的:(学习笔记,hybris,hybris,中文Hybris教程)