Skip to content

Explore the capabilities of Liferay's SiteInitializer interface

License

Notifications You must be signed in to change notification settings

chrberndt/liferay-site-initializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

liferay-site-initializer

Introduction

Explore the capabilities of Liferay's SiteInitializer interface. Implementation based on the model of

Implementation

Add required dependencies in build.gradle

  1. Add compileOnly group: "com.liferay", name: "com.liferay.site.api"dependency in build.gradle in order to use the com.liferay.site.initializer.SiteInitializer interface
  2. Add compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"dependency in build.gradlein order to use com.liferay.site.exception.InitializationException etc.
  3. Add compileOnly group: "com.liferay", name: "com.liferay.petra.string"dependency in build.gradlein order to use com.liferay.petra.string.StringPool et al.
  4. (Optional) Add compileOnly group: "javax.servlet", name: "javax.servlet-api" in order to use javax.servlet.ServletContext
  5. + any Liferay API modules you need to initialize your theme site, e.g. com.liferay.fragment.api, com.liferay.layout.api, etc.

Implement initialize() method

  1. Break down initialization tasks into manageable private helper methods, e.g. _createServiceContext, ...
  2. Wrap initialization code with a try-catch block, catch any Exception that might occur and throw an InitializationException.

Deploy

After you have deployed the module to your server, you should see a message like the following in your server's log:

	2020-01-03 10:16:09.676 INFO [pipe-start 1113][BundleStartStopLogger:39] STARTED com.chberndt.liferay.site.initializer_1.0.0 [1113]

How To Run

  1. git clone git@github.com:chrberndt/liferay-site-initializer.git into $WORKSPACE_HOME/modules
  2. Refresh the liferay-workspace with Gradle → Refresh Gradle Project (CTRL + F5)
  3. ...
  4. Create a directory $WORKSPACE_HOME/configs/local/deploy
  5. Store your (developer) license in $WORKSPACE_HOME/configs/local/deploy so that it gets automatically deployed whenever you run the initBundle task

Tools and Versions

Liferay Developer Studio

Version: 3.7.1.201910160309-ga2

gradle.properties

liferay.workspace.bundle.token.download=true
liferay.workspace.bundle.url=https://api.liferay.com/downloads/portal/7.2.10.1/liferay-dxp-tomcat-7.2.10.1-sp1-20191009103614075.7z
liferay.workspace.target.platform.version=7.2.10.1

settings.gradle

buildscript {
	dependencies {
		classpath group: "com.liferay", name: "com.liferay.gradle.plugins.workspace", version: "2.1.5"
		classpath group: "net.saliman", name: "gradle-properties-plugin", version: "1.4.6"
	}

	repositories {
		maven {
			url "https://repository-cdn.liferay.com/nexus/content/groups/public"
		}
	}
}

apply plugin: "net.saliman.properties"

apply plugin: "com.liferay.workspace"

About

Explore the capabilities of Liferay's SiteInitializer interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages