Creating New Liferay Plug-in Projects

  1. Creating New Liferay Plug-in Projects
  2. Creating New Portlets
  3. Creating New Hooks
  4. Creating New Services
  5. Creating Layout Templates

Creating New Liferay Plug-in Projects

  1. Liferay IDE supports development of five Liferay plug-in types: portlets, hooks, layout templates, themes, and EXT-style plug-ins.
  2. To create a new plug-in project with Liferay IDE, select the Liferay Plug-in Project option from the Eclipse File menu. (Go to File > New > Liferay Plug-in Project).



  3. Choose a project name for your plugin. The project name will serve as the file name of your project. Note that the project name cannot include any blank spaces.
  4. Choose a display name for your plugin. The display name will serve as the title of your project and can include blank spaces.
  5. Under Configuration, you will need to select a Plug-ins SDK and a Runtime. You should already have these installed if you followed the directions in the Getting Started section and can simply select them from a list. As defaults, you should use the latest Liferay Plug-ins SDK and the latest Liferay Portal Tomcat Server.
  6. Under Plug-in Type, select one of the five Liferay plug-in types.
  7. Click Finish, and your project should automatically build for you. You can view and modify your project using the Package Explorer that sits at the left side of the screen when using the Liferay perspective within Eclipse.

Additionally, you can create a new portlet, hook, service, or layout template within an existing project by making the appropriate selection from the File menu of Eclipse.

Creating New Portlets

  1. You can create a new portlet within an existing project by selecting Liferay Portlet from the Eclipse File menu (File > New > Liferay Portlet).



    1. In this window, you will input the information required to create a portlet class.
    2. Under Portlet plug-in project, choose a name for your portlet.
    3. The Source folder determines the location of the file directory for your portlet project.
    4. Portet class specifies the name of the Java class that your portlet extends: NewPortlet.
    5. Java package specifies the location of the Java objects that NewPortlet needs to use.
    6. Superclass specifies the location of the location of the MVCPortlet object which NewPortlet extends. Click next.



  2. You will specify portlet deployment descriptor details in this window.
    1. Under Portlet Info, enter the name, display name, and title of your portlet.
    2. Under Portlet Modes, you can choose whether or not you want your portlet to have view, edit, and display modes by checking or unchecking the appropriate boxes.
    3. Under Liferay Portlet Modes, you can choose which of six modes available to Liferay portlets you want your portlet to use.
    4. Under Resources, you can decide whether or not your portlet will create JSP files. If your portlet will do so, you have to specify a JSP folder. Additionally, you can decide whether or not your portlet will use a resource bundle file. If it will, then you have to specify the resource bundle file path. Click next.

  3. You will continue specifying portlet deployment descriptor details in this window.
    1. Under Liferay Portlet Info you can name your portlet and associate an icon to it. Check the Allow multiple instances button if you want your portlet to be instanceable. If your portlet will use CSS and Javascript you need to specify the locations of your portlet project’s CSS and Javascript folder and give your portlet a CSS classname.
    2. Under Liferay Display you can select a display category (default category: sample). There is a long list to choose from. Click next.



  4. In this last window you can specify modifiers, interfaces, and method stubs to generate within your portlet class.
    1. For modifiers, you can choose public, abstract, or final.
    2. You can add an interface by specifying its location. Click add, then browse to its location, then select.
    3. If you would like to inherit constructors or abstract methods from your portlet’s superclass, check the appropriate boxes. Then you can select the specific methods you would like to use for your portlet class.
    4. When you are done, click Finish, and your project should automatically build for you.

Creating New Hooks

  1. You can create a new hook within a Liferay hook project by selecting Liferay Hook from the Eclipse File menu. (File > New > Liferay Hook).



  2. First, you need to select a name for your new hook project. Then you can specify which hook type(s) to create by checking the appropriate boxes. After making your selections, click Next.



  3. If you selected Create JSPs, you will need to create a custom JSP folder and specify specific JSP files to overwrite. Click next.



  4. If you selected Portal properties, you will need to either define actions to be executed on portal events or specify portal properties to override. Click next.



  5. If you selected services, you will need to specify which Liferay services to extend. Click next.



  6. If you selected Language properties, you will need to create a folder for new language properties files and add the files. Click Finish to complete your hook project.

Creating New Services

  1. You can create a new service plug-in project with Liferay IDE by selecting Liferay Service from the Eclipse File menu. (File > New > Liferay Service).



  2. First, you have to specify a name for your new service project.
  3. A new service.xml will be generated for you by default. However, you may choose to use files that you have already created. Just browse to their location under Package path.
  4. Finally, enter a namespace and an author, click Finish and your services should build for you.

Creating Layout Templates

  1. You can create a new layout template with Liferay IDE by selecting Liferay Layout Template from the Eclipse File menu. (File > New > Liferay Layout Template).



  2. To create a liferay layout template, you first need to select a Layout plug-in project.
  3. You need to enter a name and an ID for your layout template.
  4. You also need to specify the location of both a template file and WAP template file for your layout temple.
  5. After you specify the location of a thumbnail file for your template, click Finish and your project should build for you.