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

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

and Return Your Path \bin\platform>
 
Step 2: Type extension generate command
   2.a) Your Path \bin\platform>ant extgen  and PRESS Enter Key

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

2.b.) By default extension template select (yempty) Press Enter  key

     
2.b.1) After Pressing Enter key  Hybris Ask
 
How To create extension in Hybris(创建Hybris的扩展)-LMLPHP

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

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
2.b.2)  Again Hybris ask   Please choose the package name of your extension.

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
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

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
Now Your extension will create  and Next STEP  Hybris told you 
 
2.b.3)

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

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

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
Double click on localextension.xml

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
Step 4 : Run ant all  and Return Command prompt

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

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

 

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
Afte Few minutes Your Server started and given a message.

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
Step 6: Go to browser and type http://localhost:9001 and PRESS enter key. Open Hybris administrative console.

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
                6.a> Open Hybris administrative console. and
                        Enter user name =admin
                                         password = nimda

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
Step 7: Go to platform->Extensions

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
     search your extension "state"  and you will get your extension.

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 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

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
                like : state/ extensioninfo.xml  and comment
 
                <!--              <webmodule jspcompile="false" webroot="state" />   -->

Double click on extensioninfo.xml

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
Step 9: Stop server (ctrl+c)  and press y How To create extension in Hybris(创建Hybris的扩展)-LMLPHP

Run ant all

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 
How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 and start server
                your path\hybris\bin\platform>hybrisserver.bat

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
after few minutes Server started
How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
 

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

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

Before

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
        
              
 
And two output directories
 
1) classes, to which ant builds generate classes
2) eclipsebin to which Eclipse generates the build output

How To create extension in Hybris(创建Hybris的扩展)-LMLPHP
个人学习
05-11 22:14