This is how a portlet application can be created using OSGI modular framework. As Liferay was written by developers for the developers to get the work done faster and easily, the Blade CLI tools does the same while making programming easy and convenient.
How to Create Portlet Application Using OSGi in Liferay 7?
1. How to Create Portlet Application
Using OSGi in Liferay 7?
2. What is Blade CLI?
Blade CLI is a command line tool that is bootstrapped on to a Gradle based environment
used for building Liferay 7.0 modules. You can simply download blade tools JAR and once
you’ve obtained the Blade Tools JAR, you can install Blade Tools through the Java Package
Manager (JPM)
4. 1) Install JAVA Package Manager(JPM) from here, if you don’t have installed in your machine yet
2) Once JPM is installed, we need to download com.liferay.blade.cli.jar from here.
3) Next, we can install Blade tools from downloaded JAR with the use of below command.
4) Alternate command to install blade tools.
6. 1) Verify your installation by writing “blade” command in command prompt. We can see below list
of MAIN OPTIONS and available sub-commands for the installed blade tools.
7. 2) We have installed Blade tools, now let’s understand its 2 important command:
blade create and blade deploy
3) To understand how to use blade create, enter blade create command into terminal. Below is output
that terminal produces.
4) We need to make sure that our module is built before we execute blade deploy command as
this command will be used to deploy application in Liferay.
9. 1) Let’s create liferay portlet application with the use of blade tools and MVC
architecture.We will create MVC portlet here. In order to create MVC portlet, we have
to run below command
2) Above command will create MVC portlet, and create folder structure as shown below.
10. 3) We are now ready to build our portlet. Run gradle build command to build your portlet.
4) If you get build successful message in your above step then we are ready to deploy
our application on liferay. Before deploying our application in liferay we need to
install remote agent with the use of blade agent install –l <Liferay home path>
command. Below message will be displayed on screen if agent has successfully installed.
5) Blade needs gradle wrapper files in your module.
To install gradle wrapper, we need to add above lines in our build.gradle file and then we
can run gradle wrapper command from command prompt.
This is how a portlet application can be created using OSGI modular framework. As Liferay
was written by developers for the developers to get the work done faster and easily, the
Blade CLI tools does the same while making programming easy and convenient.
11. 6) Once wrapper is installed, we can run blade deploy command from command prompt
to deploy our application.
7) It will copy jar file into our <module directory>/build/libs and deploy your application in liferay
8) Login to your liferay instance and you can add your new application from applications.
This is how a portlet application can be created using OSGI modular framework. As Liferay
was written by developers for the developers to get the work done faster and easily, the
Blade CLI tools does the same while making programming easy and convenient.