This is a maven archetype for creating Liferay Spring MVC Freemarker portlets. Since this type of portlet is not officially supported by Liferay, no archetype currently exists. This archetype amends that. Furthermore this is a much more complete archetype than the archetypes currently supplied by Liferay. This archetype generates a runnable portlet including a lot of examples of best practices and the best way of creating a Liferay Spring MVC Freemarker portlet. These best practices are influenced by both Liferays best practices, but also the best practices of several projects I am currently working on.
Note that the setup allows one to use either JSP or Freemarker as views or a combination thereof. When looking for a view, first the system looks for a Freemarker template with the given name. If no Freemarker template is found, it goes on to look for a JSP template with the given name. If neither is found, the system fails. Hence it is possible to create portlets with a mixture of both Freemarker and JSP templates.
This is the initial version of the archetype. Improvements will be added whenever possible. If you have suggestions, ideas, or better practices I would be very happy to hear them, or even better receive a pull request.
To be able to use this archetype you need to download and install Liferay Portal EE Maven, if you are using the enterprise edition. If you are using the community edition, maven should be able to find this itself. Note currently I've been using SP5 version, since when I started working on this project, no artifacs were published for later service packs.
- Clone the repository
- Run the command mvn install
- In your Liferay maven project run mvn archetype:generate -DarchetypeCatalog=Local -Dfilter=com.liferay.maven.archetypes:
- Select the number beside liferay-portlet-spring-mvc-freemarker-archetype
- Continue as if you are using any of the archetypes provided by Liferay