Vaadin 14 maven multi module project configuration

Hello.

I had success making one module root project working with no problem (mostly).

Now i can not figure it out , how to configure multi-module project with vaadin 14 and npm.

Structure :

  1. root
    2) BL (jpa, ws, etc,ā€¦) ā†’ jar
    3) DATA (entity, pojos,ā€¦) ā†’ jar
    4) CLIENT (client for app ws) ā†’ jar
    5) UI (vaadin 14 ui, npm, frontend,ā€¦) ā†’ war (including jar from 2 and 3)

I have frontend folder in root project which should be OK. But then i got problem with npm and node_modules.

Now my questions:

  1. Wherte to put package.json ?
  2. In which pom.xml do i need prepare-frontend, production profile etc ,ā€¦ ?

Thanks for answers.

Hi,

here you have an example of a multi module maven project: https://github.com/TatuLund/bookstore-flow-ee?files=1

In short, everything related to vaadin ( package, frontend, prepare frontend, npm) should be in the ui module.

This is exactly what i was looking for.

Thank you very much. It is working now.

Time to migrate project to v14. :slight_smile:

In case of several UI Š¼Š¾dules (several application) in multi module Vaadin project, is there a possibility to share node_modules and package*.json?

JavaOPs Empty:
In case of several UI Š¼Š¾dules (several application) in multi module Vaadin project, is there a possibility to share node_modules and package*.json?

Iā€™m not sure if I understand the question, but if you have multiple modules and run only 1 application (with jetty or spring-bootā€¦ ), you should have only 1 package*.json and mode_modules.
If you run multiple applications, then the node_modules + package*.json should be different.

Hello Jean-Christophe!
Iā€™ve multiple applications. And a lot of duplication in every node_modules.
Iā€™ve try pnpm (https://vaadin.com/docs/v14/flow/advanced/tutorial-switch-npm-pnpm.html, use 14.4.5 version), but node_modules still created for every application. Iā€™ve used NTFS links as workaround, but I hope should be a solution for sharing this multiple node_modules.

There is an explanation why pnpm is using pnpm hardlinks:
https://pnpm.js.org/en/faq

I didnā€™t go too deep into the explanation but it has been done on purpose.

Hello! As I understand, for Windows my workaround (NTFS links to node_modules) is the best solution.

Has anyone tried this with different UIs (apps)? If so I would love to hear how you got it to work.