Using Add-ons With Maven

1. Add a Dependency to the Add-on

Click the Maven POM button on an add-on details page and you will be presented with the required details to create a dependency to the add-on. You should edit the pom.xml file and add the following lines under the <repositories> section to tell Maven where the add-on repository is located.



After doing this you can simply copy-paste the <dependency> snippet from the Directory into the <dependencies> section of your pom.xml.

2. Compile the Client-side Widget Set

If the add-on contains a client-side GWT implementation, you must compile a widget set for your application with the GWT compiler.

2.1 Add Dependencies to GWT

Depending on the way you have created your project, you might already have required plugins and dependencies in your pom.xml (at least as commented out sections). See this wiki page for more information.

2.2 Define the Widget Set

After you have defined the required GWT dependencies, you must specify the widget set to be used in your application and create a stub for the GWT module descriptor. Open up the web.xml of your project and add the following lines to define the widget set to be used.



Next you must create a stub for the GWT module descriptor. So create a file /src/main/java/com/example/myapp/widgetset/MyAppWidgetSet.gwt.xml with following content.

<?xml version="1.0" encoding="UTF-8"?>
    "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN"
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />


2.3 Update and Compile the Widget Set

Now you're ready to update and compile the widget set. You can do this with the following command which first scans your project for widgets, adds them to the widget set and then compiles the widget set.

 mvn vaadin:update-widgetset install