Vaadin-maven-archetype - Why is it generating three modules?
I used the one vaadin-archetype-application-multimodule
listed here , and was discussed on this wiki .
The archetype created a project with three additional modules myproject-production
myproject-ui
and myproject-widgetset
. I'm not sure about the purpose of each project. For example, myproject-production
and myproject-ui
both projects war .
I'm not sure which parts of my code should go there. Can someone explain to me the use of each of the projects?
source to share
From the generated README.md
:
- parent project: general metadata and configuration
- xxx-widgetset: widgetset, custom client code and widget add-on dependencies
- xxx-ui: main application module, development time
- xxx-production: a module that creates a WAR development mode for deployment
For background: With Vaadin, you are essentially developing web applications using only Java code. This is the "UI" code that runs on the server and is passed behind the scenes using its "thin client" running in Javascript in the browser (this is the "widgetset"). You usually don't need to worry, but for more advanced things, you can create / render / extend widgets. This will go in the Widgetset project.
source to share
Geert3's answer is correct. I'll add some thoughts.
Single module project
First things first: If you are new to Vaadin, don't use the multimode Maven archetype as your first project (unless you are already Maven maven).
If you are new to Vaadin use the one vaadin-archetype-application
specified here . This single module module creates a working Vaadin application and in fact we have been working regularly in Vaadin for many years.
Multi-module project
The archetype vaadin-archetype-application-multimodule
creates a project that is optimized for development and deployment. Only use this after you get the chance to use Vaadin.
-parent
When you first create the Vaadin object, do a clean and build in your IDE in the parent module. This in turn assembles the other three sub-modules.
-ui
The module -ui
is the one that you use in your day-to-day work of Vaadin. You create your objects Layout
using widgets and display them in UI
. In development, you run / debug your Vaadin application by selecting the "run" or "debug" IDE command in this module.
If some of your changes don't seem to take effect, then do "clean and build" in -parent.
-widgetset
If you add an add-on (plugin / extension) with a visual component, you will need to clean and build in the project -widgetset
. Or do clean and build on the parent.
"widgetset" contains the classes and resources used to render UI widgets such as buttons, fields, labels, etc.
-production
Use the module for deployment -production
. It has some optimizations and disables the Debug Window mode as you probably don't want end users to view the internals of your Vaadin application.
Update: Vaadin 8
In Vaadin 8.1, this archetype creates a different set of modules.
-
-parent
general metadata and configuration -
-ui
main application module -
-backend
contains any server side java code and dependencies -
-addon
addon module, custom server and client code
The module UI
remains the core of your application. Here you will find the class MyUI
extending UI
. In turn, this class contains MyUIServlet
, which extends VaadinServlet
, which implements javax.servlet.Servlet
, managing the entire web application.
From the example code generated by this archetype, I can see that they assume that the module backend
contains classes for accessing data sources such as databases or web services.
Council. After first creating a project with this archetype, be sure to run the Maven Lifecycle item install
in the module parent
. Then your project is complemented with additional downloads, fully configured and able to work.
source to share