If you are a product designer working in a Liferay DXP related project this guide might be helpful for you and your daily work.
Note: We usually use zsh as terminal interface.
As a first step, open your terminal.
Install brew
brew install gradle
Install ant
brew install ant
Clone Liferay Portal
Create a folder wherever you want, navigate to it through terminal and clone the repo there:
Recommendation: /Users/your_username/Documents/Liferay
git clone https://github.com/liferay/liferay-portal
Install Java
Download it from Oracle
Configure Java in your machine
Open a new terminal tab and go to your user folder.
cd /Users/your_username
You can use pico or any other terminal text editor.
pico .zshrc
Paste this inside:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Homeexport ANT_OPTS="-Xms4096m -Xmx4096m -XX:MaxPermSize=512m -Dorg.gradle.workers.max=11"
Note: Adjust 'jdk1.8.0_261' to the version number you have just downloaded
Everyday to update your portal you have to do the following from liferay-portal folder
cd /Users/your_username/Documents/Liferay/liferay-portal
Clean bundles
rm -rf ../bundles/data ../bundles/osgi/state
Get the news
git pull
Build them
ant all
You just need to run this from liferay-portal folder
../bundles/tomcat-9.0.53/bin/catalina.sh run
Note: Adjust 'tomcat-9.0.53' to the version number in bundles folder
Changing to DXP version
ant setup-profile-dxp
Changing to Portal version
ant setup-profile-portal
After any of them you might need to get the bundle snapshot
ant snapshot-bundle
Aliases let allow us to write our custom commands so we don't have to remember everything. You just need to write them in your .zshrc file.
Go to your user folder
cd /Users/your_username
Edit .zshrc file
pico .zshrc
Paste all this inside
# Go to portalfunction portal {cd /Users/your_username/Documents/Liferay/liferay-portal}# Cleans bundlesfunction portal-bundle-clean {rm -rf ../bundles/data ../bundles/osgi/state}# Cleans bundles (to run Asset Libraries) and runs portalfunction portal-run {portal-bundle-clean &&../bundles/tomcat-9.0.53/bin/catalina.sh run}# Updating Portalfunction portal-update {git pull && ant all}
Now, restart your terminal.
Go to portal:
portal
Update your portal, if needed:
portal-uptate
Run portal:
portal-run
Make sure there are no other java processes running in the same port.
pkill java
Sometimes it might not work due to a bad update or databases problems.
git clean -fdx
then run,
portal-update