Failed to load Widgetsets in maven project in eclipse

前端 未结 3 1198
情书的邮戳
情书的邮戳 2021-01-06 15:11

I have created a vaadin web application using maven in eclipse. In particular I have used the archetype vaadin-archetype-touchkit as described in t

3条回答
  •  长发绾君心
    2021-01-06 15:39

    The web.xml is no longer needed only if you use servlet 3.0 configuration (annotating your servlet as described 4.8.3. WEB Servlet Class)

    Usually you'd configure your Vaadin 3.0 Servlet Config in this way:

    public class MyUI extends UI {
    
          @WebServlet(value = "/*", asyncSupported = true)
          @VaadinServletConfiguration(productionMode = false, ui = MyUI.class)
          public static class Servlet extends VaadinServlet {
          }
    
          @Override
          protected void init(VaadinRequest request) {
                //your init stuff here
          }
    }
    

    Where using the @VaadinServletConfiguration as shortcut for setting vaadin-related params.

    Now, if you have no vaadin addon in your project (so you're using the default widgetset), that's it, no more work is required.

    Instead, if you're using custom addons, you must specify which widgetset to use in the @VaadinServletConfiguration simply by adding the widgetset parameter in this way

    public class MyUI extends UI {
    
          @WebServlet(value = "/*", asyncSupported = true)
          @VaadinServletConfiguration(widgetset="com.bla.bla.MyWidgetSet",productionMode = false, ui = MyUI.class)
          public static class Servlet extends VaadinServlet {
          }
    
          @Override
          protected void init(VaadinRequest request) {
                //your init stuff here
          }
    }
    

    Otherwise you must create the web.xml manually as usual...

    When it comes to maven, I think you've just to run mvn clean package and on the package phase the maven-vaadin-plugin will compile you're widgetset automatically.

提交回复
热议问题