A little project to play around with Liferay Portal, Spring Framework, and MySQL.
Using:
- Java 8
- Maven 3
- Spring Framework 4.3.5
- Spring Core
- Spring Transactions
- Spring Data JPA
- Spring Portlet MVC
- Liferay 6.2
- Project Lombok
- Portlet 2.0
- MySQL 5
- JPA 2.1 + Hibernate (as JPA provider)
- JSP + JSTL + Spring Form taglib
- Mixed XML Schema-based and annotation based Spring configuration
$ git clone https://github.com/naXa777/liferay-portlet-spring-mvc-app.git
$ cd liferay-portlet-spring-mvc-app
$ mvn package
- Define Liferay properties in pom.xml
- Create portal database:
CREATE DATABASE lportal
CHARACTER SET utf8
COLLATE utf8_general_ci;
- Add database portal properties (portal-ext.properties file in $LIFERAY_HOME directory) with your MySQL credentials:
# MySQL
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=
- Check connection:
After Liferay Portal relaunch with the above settings you should have 180 new tables inlportal
database.
If you're using Liferay Portal with Tomcat, copy the war to the deploy directory and wait for Liferay to deploy it. After successful deploy you should be able to find the portlet under Sample category.
$ cp target/portlet-demo-1.0.war $LIFERAY_HOME/deploy/
or
$ mvn liferay:deploy
- Import project into IntelliJ IDEA
- Install Lombok plugin and restart
- For project deployment:
- Create Maven Run configuration with
package liferay:deploy
specified in command line.
- Create Maven Run configuration with
- For running Liferay from IntelliJ
- For debugging your application
- Create Remote Run configuration for remote debug. See this article for details.
Copyright 2017 Pavel Homal
Licenced under the WTFPL Licence: http://www.wtfpl.net/