Is AppWidgetSet.gwt.xml necessary?

Hello guys.
I am reading the nice book I have just bought called ‘Learning Vaadin 7, 2nd edition’ and I have forked the githum code so that I can inspect the Twaattin application.

The way I created the application is described here (http://stackoverflow.com/questions/16073944/how-do-i-start-a-new-vaadin-project-in-intellij-idea).
So if you read this link, you’ll see that I created it manually using mvn command line and then I opened the app using my IntelliJ Idea 12 Ultimate.

Inside my com.packtpub.learnvaadin.twaattin package I see that there is an AppWidgetSet.gwt.xml with the following code :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
    <!--
        This file is automatically updated based on new dependencies by the
        goal "vaadin:update-widgetset".
    -->

    <!-- Inherit DefaultWidgetSet -->
    <inherits name="com.vaadin.DefaultWidgetSet" /> 

    <!--
     Uncomment the following to compile the widgetset for one browser only.

     Multiple browsers can be specified as a comma separated list. The
     supported user agents at the moment of writing were:


     The value gecko1_8 is used for Firefox and safari is used for webkit
     based browsers including Google Chrome.
    -->
    <!-- <set-property name="user.agent" value="safari"/> -->

    <!--
     To enable SuperDevMode, uncomment this line.

     See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more
     information and instructions.
    -->
    <!-- <set-configuration-property name="devModeRedirectEnabled" value="true" /> -->

</module>

And the entry point class is the following :

package com.packtpub.learnvaadin.twaattin;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Theme("mytheme")
@SuppressWarnings("serial")
public class TwaattinUI extends UI
{

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = TwaattinUI.class, widgetset = "com.packtpub.learnvaadin.twaattin.AppWidgetSet")
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
        
        Button button = new Button("Click Me");
        button.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                layout.addComponent(new Label("Thank you for clicking"));
            }
        });
        layout.addComponent(button);
    }

}

Looking at the github code I see that this widget set is not being used.
So I wonder why mvm creates that file and if I can tell it not to create it.
Thank you.

Am I asking in the wrong place?

I’m not certain how the Maven script works, but basically you don’t need a custom widgetset unless your project contains custom client-side GWT code, for instance custom components. You’ll want to remove the widgetset=“…” parameter from the @VaadinServletConfiguration annotation to use the builtin default widgetset.

The maven command I use is the following :

mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.7

The archetype creates the widgetset because many/most real world applications use at least some custom widgets (often in the form of widget add-ons) and it is much harder to create a widgetset by hand than automatically in the archetype.

If you want to remove it, you should also remove the reference to it in @VaadinServletConfiguration as Johannes suggested. If I remember correctly, the POM file generated by the archetype is configured to autodetect widgetsets and so shouldn’t need changes if you remove the custom widgetset.