The document discusses various techniques for improving development efficiency when working with Liferay, including:
- Generating code using templates, archetypes, and tools like Damascus to avoid manually writing recurring code
- Leveraging features of the Service Builder to generate layers of services code
- Using tools like JRebel to enable instant deployment and synchronization between code changes and the running application
- Configuring the development environment and application server to reduce build and deployment times
- Testing static resources directly from the file system to bypass full deployment cycles
The document encourages sharing tips and tricks for faster development on blogs and forums to advance the community's knowledge.
3. Sébastien Le Marchand | @slemarchand
§ 10 years of experience on Liferay (since v4.3)
§ Including 6 years as employee of a « Gold Service Partner »
company
§ Now Freelancer
Sébastien Le Marchand
@slemarchand linkedin.com/in/slemarchand
Paris, France
5. Sébastien Le Marchand | @slemarchand
« Efficiency is the (often measurable) ability to
avoid wasting materials, energy, efforts, money,
and time in doing something or in producing a
desired result. In a more general sense, it is the
ability to do things well, successfully, and
without waste. »
[wikipedia.org]
7. Sébastien Le Marchand | @slemarchand
§ Writing & debugging recurring code
§ Waiting during compilation, packaging or deployment
§ Repeating again and again the same manual tasks from GUI
What is waste in development activities?
9. Sébastien Le Marchand | @slemarchand
§ Avoid time spent to manually write this code
§ Reduce bugs… and so reduce time to fix them !
§ Improve code homogeneity… and so maintenability !
Why generate « recurring » code?
11. Sébastien Le Marchand | @slemarchand
§ Define services through service.xml file
§ Persistance services layer: fully generated
§ Business services layer : very basic… you need to code the
missing parts!
Service Builder: generate services layers
13. Sébastien Le Marchand | @slemarchand
§ Some basic CRUD mechanics (ID creation for example)
§ Permissions
§ Indexing
§ Asset features handling
§ Web layer (the portlet!)
§ …
Service Builder missing stuff for common use-cases
17. Sébastien Le Marchand | @slemarchand
§ Initialize project (from a Liferay Workspace)
§ Update model in events-manager/base.json file
§ Generate modules with Damascus
Just do it!
$ cd events-manager
$ damascus -create
$ damascus -init EventsManager -p com.slemarchand.events
27. Sébastien Le Marchand | @slemarchand
§ « Fire & Forget »: after manual
code modification, you can’t safely
launch generation again
§ If you want, you can just keep
small parts of generated code
What are usages for Damascus?
« Service » components
« Web » components
Service Builder generated code
28. Sébastien Le Marchand | @slemarchand
§ Give some feedback
§ Create new issues
§ Comment existing issues
§ Contribute
§ See README.md file in repo
We need you!
https://github.com/yasuflatland-lf/damascus
29. Sébastien Le Marchand | @slemarchand
Tribute to XML Portlet Factory
Jack A. Rider
Juan Gonzalez
§ Pioneer of CRUD full-generation for Liferay
§ Available for all 6.x versions of Liferay
§ 6.0
§ 6.1
§ 6.2
§ Get it
§ http://www.xmlportletfactory.org
§ https://github.com/xmlportletfactory/xmlportletfactory
31. Sébastien Le Marchand | @slemarchand
§ (Re-)Starting app server (maybe 1 or 2 times by day),
§ Building project,
§ Deploying to local server,
§ First request (empty cache, JSP compilation, etc)
Developing implies so often waiting
33. Sébastien Le Marchand | @slemarchand
§ Use Tomcat on your local machine
§ Uninstall permanently the unused modules
§ Remove or alter some *.lpkg files, from ${liferay.home}/osgi/marketplace
§ Don’t forget to clean work & osgi/state directories
Reducing app server start time
34. Sébastien Le Marchand | @slemarchand
« Jukebox » sample application(2):
§ Build (blade) in 19,78 s without Gradle deamon
§ Build (blade) in 14,78 s with Gradle deamon
§ Bundle installation in 3,2 s
Deployement duration(1)
(1): MacBook Air (13-inch, Mid 2013) - 1,7 GHz Intel Core i7 - 8 Go 1600 MHz DDR3
(2): https://github.com/epgarcia/jukebox-portlet/tree/LSNA.2016.Upgrade.to.7
35. Sébastien Le Marchand | @slemarchand
§ JRebel synchronize IDE workspace and the application deployed
on the local server.
§ When developer make some code changes, JRebel instantly
update bytecode (and resources) on local server, without
full deployment.
§ Adding / removing / changing Classes, Methods, Constructors,
Fields, Annotations and Static field values
JRebel
36. Sébastien Le Marchand | @slemarchand
§ 3 steps
§ Set JRebel Java Agent via $JAVA_OPTS
§ Add org.zeroturnaround:gradle-jrebel-plugin plugin to your Gradle project
§ Customize rebel.xml
§ All details :
§ https://web.liferay.com/fr/web/jardineworks/blog/-/blogs/liferay-7-jrebel
How-to configure JRebel for Liferay 7
37. Sébastien Le Marchand | @slemarchand
§ JRebel is a commercial product (there is a free-trial period)
§ Not everyone can or want to buy a licence
§ So alternatives are welcome in some contexts!
Instant deployment without JRebel ?
38. Sébastien Le Marchand | @slemarchand
§ For themes, standard liferay-theme-tasks do the job with
watch task
§ https://dev.liferay.com/develop/reference/-
/knowledge_base/7-0/theme-gulp-tasks
Instant theme deployment
$ gulp watch
39. Sébastien Le Marchand | @slemarchand
§ Install
§ Run from the module directory
§ Each change in module sources is automatically
synchronized using gogo shell
Instant modules deployment: liferay-osgi-watch
$ sudo npm install -g liferay-osgi-watch
$ lwatch
41. Sébastien Le Marchand | @slemarchand
§ Serving resources directly from source code
§ Provide capability to define rules to route some browser
requests to particular local files
§ With « Map Local » proper configuration, static resources
(CSS, JS) are loaded in browser from IDE workspace local files
JS & CSS: « Map Local » feature of Charles Proxy
charlesproxy.com
42. Sébastien Le Marchand | @slemarchand
§ You can test your local static resources (including JS)
§ With no deployment delay
§ On any environment… including PRODUCTION 🎉
§ Privately, without impacting other users
Beyond the local server
44. Sébastien Le Marchand | @slemarchand
§ Each of you knows at least one uncommon trick to develop
faster
§ All together, you are an huge developement tips database !
YOU are the next step!