Git Product home page Git Product logo

addressbook-portlet's Introduction

Address Book Portlet Demo for Liferay 7

An example project to showcase how Vaadin 23.1+ portlet support works in a Liferay 7 container. Clone the repository and import the project to the IDE of your choice as a Maven project. You need to have Java 11 installed.

The documentation for Vaadin Portlet support is available here.

Running the portlet under Liferay

Before the portlet application can be run, it must be deployed to a portal for this branch the portal supported is Liferay:

  1. Build the whole project using mvn install in the root

  2. We assume Liferay is running in http://localhost:8080/, an easy way to run a local copy of Liferay is to use their official docker images. Below is an example of a docker-compose file you can use (note the used Liferay version, 7.2+ should work).

version: "2.2"
services:
    liferay-dev:
        image: liferay/portal:7.2.1-ga2
        environment:
            - LIFERAY_JAVASCRIPT_PERIOD_SINGLE_PERIOD_PAGE_PERIOD_APPLICATION_PERIOD_ENABLED=false
        ports:
            - 8080:8080
            - 8000:8000
        volumes:
            - ./deploy:/mnt/liferay/deploy
            - ./files:/mnt/liferay/files
  1. Add the following to the end of the last line in Tomcat's setenv.sh (/var/liferay/tomcat-<version>/bin) before starting Liferay. When using the above docker-compose file place an edited copy of setenv.sh in ./files/tomcat/bin.
 -Dvaadin.portlet.static.resources.mapping=/o/vaadin-portlet-static/
  1. Download and add the Jna dependency JARs of a certain version into /var/liferay/tomcat-<version>/webapps/ROOT/WEB-INF/lib/ (or shielded-container-lib/):

    How to copy these files is described [here](https://learn.liferay. com/dxp/latest/en/installation-and-upgrades/installing-liferay/using-liferay -docker-images/providing-files-to-the-container.html#using-docker-cp)

    This is needed because Liferay uses an older version of Jna and running Vaadin Portlet in dev mode causes a conflict of dependencies used by Liferay and Vaadin License Checker (NoClassDefFound exception).

    Here is a useful [docs](https://learn.liferay. com/dxp/latest/en/building-applications/reference/jars-excluded-from-wabs. html) describing how to add third-party dependency version you want.

  2. Run docker-compose up

  3. Deploy all wars: addressbook-grid/target/address-book-grid.war, addressbook-form/target/address-book-form.war and addressbook-bundle/target/vaadin-portlet-static.war, to your docker container by copying them to ./deploy/ (the copied files should disappear when deployed).

  4. Wait for the bundles to start, then visit http://localhost:8080/. Set up a new user if you're running Liferay for the first time. Default is [email protected]/test. Log in into Liferay.

  5. The deployed portlet needs to be added to a portal page. Do this by

  • Selecting the Plus or the Pen icon near top right of the page (exact placement and look varies by Liferay version) add elements to the current page.
  • Under Widgets on the right sidebar find Vaadin Sample category under which you will find entries for Contact List and Contact Form, drag and drop them onto the page.
  • If at the top right of the page, in edit mode, you see a Publish button, use it to make your changes public (7.3+).

Remote debugging for Liferay

In order to remote debug your portlet under Liferay add the following to the end of the last line in Tomcat's setenv.sh (/var/liferay/tomcat-<version>/bin) before starting Liferay. When using the above docker-compose file place an edited copy of setenv.sh in ./files/tomcat/bin before docker-compose up.

 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

Remote debugging (JDWP) is now available on port 8000 (to activate in IntelliJ, choose Run -> Attach to Process...).

Production build

To build the production .war run:

mvn package -Pproduction

Deploy all wars: addressbook-grid/target/address-book-grid.war, addressbook-form/target/address-book-form.war and addressbook-bundle/target/vaadin-portlet-static.war, to your web server / portal.

Adding a new Portlet module

To add a new Portlet module to the project create a default vaadin portlet module. The module should contain its own portlet.xml file.

Add to the new module the resource file flow-build-info.json into ./src/main/resources/META-INF/VAADIN/config with the contents:

{
  "externalStatsUrl": "/o/vaadin-portlet-static/VAADIN/config/stats.json"
}

Add the module sources to the bundle module build-helper-maven-plugin as added sources:

<sources>
  <source>../moduleName/src/main/java</source>
  ...
</sources>

Then build the whole project again with mvn install

Current known issues running under Liferay

See Vaadin Portlet release notes for a limitation and known issues list.

addressbook-portlet's People

Contributors

mehdi-vaadin avatar mshabarov avatar caalador avatar ujoni avatar bbmarkus avatar mstahv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.