Failed to load Widgetsets in maven project in eclipse

房东的猫 提交于 2019-12-01 00:57:44

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.

For me, adding the following to pom.xml helped:

    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
        <version>${vaadin.version}</version>
    </dependency>

here is the readme in the root of the project

To compile the entire project, run "mvn install". To run the application, run "mvn jetty:run" and open http://localhost:8080/ .

To develop the theme, simply update the relevant theme files and reload the application. Pre-compiling a theme eliminates automatic theme updates at runtime - see below for more information.

Debugging client side code - run "mvn vaadin:run-codeserver" on a separate console while the application is running - activate Super Dev Mode in the debug window of the application

To produce a deployable production mode WAR: - change productionMode to true in the servlet class configuration (nested in the UI class) - run "mvn clean vaadin:compile-theme package" - See below for more information. Running "mvn clean" removes the pre-compiled theme. - test with "mvn jetty:run-war

follow the instruction and you will get the correct page : )

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!