OK, lets start from the beginning. The widgetset is the pre-compiled javascript files that contain the vaadin code that is run inside a browser. All vaadin projects need this. By default, we provide the DefaultWidgetset that contains everything that is part of vaadin. But if you want to use addons (as you do), you need to somehow add the code from the addons to the widgetset (which is what we are trying to do). You do this by compiling your own widgetset using the vaadin-client-compiler JAR file and ‘mvn vaadin:compile’-command. Please check your pom file to make sure you have the
vaadin-client-compiler
dependency, and that you do NOT have the
vaadin-client-compiled
dependency. You can also remove the wscdn dependency that you added.
Now, for the compilation to work properly, you need to tell the compiler what you want it to do. This is done with a widgetset definition file. It is an XML file in your resources folder, typically inside some package, like this: com/yourcompany/yourapp/YourWidgetset.gwt.xml. The content looks like this:
[code]
<?xml version="1.0" encoding="UTF-8"?>
[/code]As you can see, we extend the default widget set. If you have the file, we can start the compilation. Run this maven command:
mvn vaadin:clean vaadin:update-widgetset vaadin:compile
[/code]This will scan your classpath for any add-ons, add them to your XML file, and compile a new widgetset. You can check if it worked by opening your widgetset folder under src/main/webapp/VAADIN/widgetsets, it should have a folder called com.yourcompany.yourapp.YourWidgetset. The folder name is your widgetset name. Now, the only thing you need to do, is tell your app to use the widgetset, either in server.xml:[code]
<servlet>
…
<init-param>
<description>Widget Set to Use</description>
<param-name>widgetset</param-name>
<param-value>com.yourcompany.yourapp.YourWidgetset</param-value>
</init-param>
</servlet
Or with an annotation on the UI class:
@Widgetset("com.yourcompany.yourapp.YourWidgetset")
Or with the servlet configuration widgetset:
@VaadinServletConfiguration(... , widgetset="com.yourcompany.yourapp.YourWidgetset")
You should be good to go now.
The last thing to remember is that all developers on the project will need to do this for the project to work for them, OR, you can add the widgetset files to your source repository. They do not contain anything machine-dependent, so everyone can use the same files you compiled. The next time when you add (or remove) add-ons, do the compilation again (the maven command above). You can also read the Book of Vaadin on add-ons:
https://vaadin.com/docs/-/part/framework/addons/addons-maven.html
That’s it, hope this helps