🔷 Liferay development environment

Development environment setup to work as Liferay developer.

Before going through this documentation, you might want to check my development environment configuration to setup your system.


  1. Install OracleJDK 8.
  2. Install Apache ANT.
  3. Install Apache Maven.
  4. Ensure /usr/lib/jvm/default-java points to Java home.
  5. Ensure /usr/lib/jvm/default-ant points to ANT home.
  6. Ensure /usr/lib/jvm/default-maven points to Maven home.
  7. mkdir -p ~/Projects/community-portal
  8. ln -s $CHACHI_PATH/liferay ~/Projects/community-portal/config
  9. cd ~/Projects/community-portal && ln -s config/liferay-editorconfig .editorconfig
  10. git clone git@github.com:p2kmgcl/liferay-portal.git ~/Projects/community-portal/liferay-portal
  11. ln -s ~/Projects/chachi-shell/liferay/git-config ~/Projects/community-portal/liferay-portal/.git/config
  12. git clone https://github.com/liferay/liferay-binaries-cache-2020.git ~/Projects/community-portal/liferay-binaries-cache-2020
  13. buildLiferayPortal
  14. cd ~/Projects/community-portal/bundles && ln -s ../config/portal-ext.properties portal-ext.properties
  15. git clone https://github.com/holatuwol/liferay-intellij ~/Projects/community-portal/liferay-intellij
  16. cd ~/Projects/community-portal/liferay-portal && ../liferay-intellij/intellij

Github Token for source format

Since 2023-04-13, SF is looks for vulnerabilities in build.gradle files. In order to make this work, we need to generate a GitHub Legacy/Classic token with the read:repo_hook permission and place it in $HOME/github.token.

Add new GitHub Token.

Build portal drama

If portal doesn't compile some steps must you follow, check this options each by each, and if it doesn't work go back to sleep.

  • Update master and try again.
  • git clean -fd.
  • git clean -fdX.
  • Reinstall Java, MySQL, Ant, Maven and Node.
  • Try to use the latest docker nightly.
  • Use this day to check bugs and PTRs.
  • Tell someone to stream their computer and pair-program the whole day.
  • Try on a brand-new pc.

Random notes

  • Liferay Loader full dependency graph: Control Panel -> Configuration -> System Settings -> Infrastructure -> Javascript Loader -> Explain Module Resolutions
  • Format source all changes in branch: cd ~/Projects/community-portal/liferay-portal/portal-impl && ant format-source-current-branch
  • Create language files: gradlew buildLang
  • Format code: gradlew formatSource
  • Run FrontEnd tests: gradlew packageRunTest
  • Toggle jQuery: Product menu -> Configuration -> System settings -> Third party -> jQuery
  • IE11 polyfills: IETopHeadDynamicInclude.java
  • Run poshi tests locally (docs): ant -f build-test.xml run-selenium-test -Dbrowser.chrome.bin.file=/path/to/chrome/binary -Dtest.class=FileName#TestName
    • Specific chromium releases can be downloaded from cypress.io.
    • If tests doesn't run, try emptying bundles/logs directory, but keeping the directory itself.
  • CSS RTL Conversion is made here: frontend-css-rtl-servlet and CSSRTLConverter.java
  • Fragment bundler rendering process: FragmentEntryLinkModelListener.java
  • Upgrade database: cd ~/Projects/community-portal/bundles/tools/portal-tools-db-upgrade-client && ./db_upgrade.sh
  • Connect to telnet: telnet localhost 11311
  • Liferay<=7.0 supports MySQL<=5.7 using driver com.mysql.jdbc.Driver (newer versions will fail).
  • Run Java tests with Ant: ant test-method -Dtest.class=JSONUtilTest -Dtest.methods=testCacafutiNiceParty -Djunit-debug=true
  • Running integration tests: gradlew testIntegration --tests com.liferay.cacafuti.test.CacafutiTest