

Liferay CLI
Liferay CLI - lfr - is an unofficial tool written in Go that helps you create & manage Liferay projects.
Why?
I needed a subject to play with Go. Writing a CLI tool is fun - especially with Cobra - and I wanted to explore how to distribute it using GitHub Actions (and GoReleaser).
Also, I get sometimes frustrated by Blade and wanted to focus on providing:
- Better performances (cf. benchmarks)
- Better support for Maven
- Shorter commands
- More consistent commands names and ordering
- Details after any command execution
- Shell completion
Getting Started
Checkout the release page to download the binary for your distribution.
Examples:
Get a completion script for your shell:
lfr completion bash
bash, zsh, fish and powershell are supported.
Run a diagnosis:
lfr diagnose
# or shorter
lfr diag
The output of this command will list your installations of Java, Blade and Docker. It will also display how much space are being used by cached bundles and docker images.
Create a Liferay workspace:
lfr create workspace liferay-workspace
# or shorter
lfr create ws liferay-workspace
# or even shoter
lfr c ws liferay-workspace
Create a client extension:
lfr create client-extension
# or shorter
lfr create cx
# or event shorter
lfr c cx
Since client extensions are available as samples in liferay-portal repo, it will checkout the subdirectory containing them under $HOME/.lfr/liferay-portal.
Run a Gradle or Maven task:
lfr exec [tasks...]
# Gradle example
lfr exec build
# Maven example
lfr exec clean install
Shortcuts for common tasks:
# Build
lfr build
#or shorter
lfr b
# Deploy
lfr deploy
# or shorter
lfr d
Start Liferay and follow the logs:
lfr start
lfr logs -f
Benchmarks
Using Hyperfine.
Create Workspace
| Command |
Mean [s] |
Min [s] |
Max [s] |
Relative |
blade init -v 7.4 liferay-workspace |
1.837 ± 0.300 |
1.665 |
2.668 |
19.94 ± 5.69 |
lfr create ws liferay-workspace |
0.092 ± 0.022 |
0.076 |
0.178 |
1.00 |
Create MVC Portlet
| Command |
Mean [s] |
Min [s] |
Max [s] |
Relative |
blade create -t mvc-portlet my-mvc-portlet |
1.608 ± 0.021 |
1.570 |
1.647 |
59.70 ± 112.37 |
lfr create mvc my-mvc-portlet |
0.027 ± 0.051 |
0.015 |
0.345 |
1.00 |
Create Service Builder
| Command |
Mean [s] |
Min [s] |
Max [s] |
Relative |
blade create -t service-builder my-service-builder |
1.628 ± 0.057 |
1.573 |
1.772 |
82.00 ± 134.01 |
lfr create sb my-service-builder |
0.020 ± 0.032 |
0.014 |
0.332 |
1.00 |
License
MIT