Creating a Generic Portlet in Eclipse
Here we describe the creation of a generic portlet project in Eclipse. You can use the Maven archetypes also in other IDEs or without an IDE.
For Liferay portlet development, you may instead want to use the Maven archetype or Liferay IDE to create the project, as described in “Developing Vaadin Portlets for Liferay”.
Creating a Project with Vaadin Plugin
The Vaadin Plugin for Eclipse has a wizard for easy creation of generic portlet projects. It creates a UI class and all the necessary descriptor files.
Creating a portlet project is almost identical to the creation of a regular Vaadin servlet application project. For a full treatment of the New Project Wizard and the possible options, please see “Creating the Project”.
Start creating a new project by selecting from the menu File › New › Project…+
In the New Project window that opens, select Web › Vaadin 7 Project and click Next.
In the Vaadin Project step, you need to set the basic web project settings. You need to give at least the project name, the runtime, select Generic Portlet for the Deployment configuration; the default values should be good for the other settings.
You can click Finish here to use the defaults for the rest of the settings, or click Next.
The settings in the Web Module step define the basic servlet-related settings and the structure of the web application project. All the settings are pre-filled, and you should normally accept them as they are and click Next.
The Vaadin project step page has various Vaadin-specific application settings. These are largely the same as for regular applications. Setting them here is easiest - later some of the changes require changes in several different files. The Create portlet template option should be automatically selected. You can give another portlet title of you want. You can change most of the settings afterward.
Create project template
Creates a UI class and all the needed portlet deployment descriptors.
Application name
The application name is used in the title of the browser window, which is usually invisible in portlets, and as an identifier, either as is or with a suffix, in various deployment descriptors.
Base package name
Java package for the UI class.
Application class name
Name of the UI class. The default is derived from the project name.
Theme name
Name of the custom portlet theme to use.
Portlet version
Same as in the project settings.
Portlet title
The portlet title, defined in portlet.xml, can be used as the display name of the portlet (at least in Liferay). The default value is the project name. The title is also used as a short description in liferay-plugin-package.properties.
Vaadin version
Same as in the project settings.
Finally, click Finish to create the project.
Eclipse may ask you to switch to J2EE perspective. A Dynamic Web Project uses an external web server and the J2EE perspective provides tools to control the server and manage application deployment. Click Yes.