To use add-ons in a project that uses Maven, you simply have to add them as dependencies in the POM. If the add-ons includes widget sets, as at least most component add-ons do, you also need to define and compile a project widget set.

Creating, compiling, and packaging a Vaadin project using Maven was described in Section 2.5, “Creating a Project with Maven”.

Most add-on components in Vaadin Directory include a widget set which must be compiled before using the add-on. Some add-ons, such as data binding add-ons or themes, do not include a widget set.

This should complete the task of enabling a widget set compilation and use in your project. Next, you need to update the project widget set, as described in the next section.

If you have enabled widget set compilation as described earlier and created the project widget set, you need to update the widget set to include the default widget set and any widget sets included in add-ons. You can do this simply by running the vaadin:update-widgetset goal in the project directory.

$ mvn vaadin:update-widgetset
...
[INFO] auto discovered modules [your.company.gwt.ProjectNameWidgetSet]
[INFO] Updating widgetset your.company.gwt.ProjectNameWidgetSet
[ERROR] 27.10.2011 19:22:34 com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Widgetsets found from classpath:
[ERROR]         your.company.gwt.ProjectNameWidgetSet in file:/home/magi/itmill/maventest/project-name/src/main/java
[ERROR]         com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/home/magi/.m2/repository/com/vaadin/vaadin/6.7.1/vaadin-6.7.1.jar!/
[ERROR] 
[ERROR] 27.10.2011 19:22:34 com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Search took 8ms
...

Do not mind the "ERROR" labels, they are just an issue with the Vaadin Plugin for Maven.

If you later add other add-ons in the project, or remove some, you need to run the widget set update again.

The project widget set also needs to be compiled using the GWT Compiler. We enabled the Maven add-ons for GWT compilation in the previous section. You can compile the widget set with the gwt:compile goal as follows:

$ mvn gwt:compile

You need to recompile the widget set if you upgrade to a new version of Vaadin or any of the included widget sets. It is not done automatically by the package goal. If you have added or removed add-ons, you also need to run the vaadin:update-widgetset goal before the compilation.

This concludes the compilation of add-on widget sets. You still need to compile and package the actual application with the package goal, as described in Section 2.5, “Creating a Project with Maven”.