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.

<repository>
   <id>vaadin-addons</id>
   <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>

 

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.

<init-param>
    <param-name>widgetset</param-name>
    <param-value>com.example.myapp.widgetset.MyAppWidgetSet</param-value>
</init-param>

 

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"?>
<!DOCTYPE module PUBLIC
    "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN"
    "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
</module>

 

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