How To create extension in Hybris(创建Hybris的扩展)

What is an extension?
An extension is an encapsulated piece of the Hybris Commerce Suite that can contain business logic, type definitions, a web application, or Hybris Management Console (hmc) configuration.
There are two types of extensions :
1. Predefined
2. User defined Extension
Or
Basically  extension is a  unit of functionality in hybris. in other work you can say each  extension is used for a specific functionality in hybris. If you look the  architecture of Hybris then you can found that if you need too  customize any functionality of Hybris then you do by  creating your own extension So every  extension in hybris contains
 
1. Bussiness logic
2. type defintion(items.xml)
3. web application
4. hmc configuration


Go To command prompt YourPath\hybris\bin\platform  And Type Following Commands

Step 1: Set ant Environment

               Your Path\hybris\bin\platform>setantenv.bat and PRESS Enter key

    

and Return Your Path \bin\platform>

Step 2: Type extension generate command

    2.a) Your Path \bin\platform> ant extgen   and PRESS Enter Key

  
2.b.) By default extension template select (yempty) Press Enter  key
     
2.b.1) After Pressing Enter key  Hybris Ask


If  simply press enter, by Default your extension name is " training" Other wise Type Your Extension name here. 
For Example : type "State" and PRESS enter key


2.b.2)  Again Hybris ask   Please choose the package name of your extension.



type Your package name, If press Enter by default package name accept other wise type Here. In My Case package name is " org.hybris.platform.state " and press enter



Now Your extension will create  and Next STEP  Hybris told you 

2.b.3)



  

When you perform ant target extgen then an extension will be created in custom folder.


Step 3: Update  new extension in You path/hybris/config/localextensions.xml



Double click on localextension.xml


Step 4 : Run ant all  and Return Command prompt



Step 5 Run Server  type command hybrisserver.bat and PRESS enter key

          


Afte Few minutes Your Server started and given a message.



Step 6: Go to browser and type http://localhost:9001 and PRESS enter key. Open Hybris administrative console.



                 6.a> Open Hybris administrative console. and
                        Enter user name =admin
                                         password = nimda 





Step 7: Go to platform->Extensions
                           



     search your extension "state"  and you will get your extension.




 if the extension comes with a core extension module, an hmc extension module, webroot extension module

Step 8: Go to your extension/extensioninfo.xml. and comment




                like : state/ extensioninfo.xml  and comment

                 <!--              <webmodule jspcompile="false" webroot="state" />   --> 


Double click on extensioninfo.xml


Step 9: Stop server (ctrl+c)  and press y 


 Run ant all



 and start server
                your path\hybris\bin\platform>hybrisserver.bat




after few minutes Server started



Go to browser http://localhost:9001 
                      and type username|password: admin|nimda
Go to platform->Extensions  
and check no accessible webroot  for state



Before
        
              

And two output directories

1)  classes, to which ant builds generate classes
2)  eclipsebin to which Eclipse generates the build output

个人学习

猜你喜欢

转载自blog.csdn.net/chinassj/article/details/80880772
今日推荐