我想将Vaadin图表添加到我的项目中,我添加了maven依赖项,安装许可证和vaadin clean,更新widgetset和编译。但是当我运行应用程序并打开localhost:8080时,在控制台中出错:
The widgetset in use does not seem to be built for the Vaadin
version in use. This might cause strange problems - a
recompile/deploy is strongly recommended.
Vaadin version: 8.0.0
Widgetset version: 8.0-SNAPSHOT
并在用户界面上显示以下消息:https://www.screencast.com/t/deDF6kVsvDdU
以下是我的pom.xml中的vaadin依赖:
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-charts</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>8.0.4</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<strict>true</strict>
</configuration>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我该如何解决这个问题?
更新:
以下是mvn vaadin:clean vaadin:compile
的输出(运行此操作无法解决我的问题):
[INFO] --- vaadin-maven-plugin:8.0.4:clean (default-cli) @ test ---
[WARNING] GWT plugin is configured to detect modules, but none were found.
[INFO]
[INFO] --- vaadin-maven-plugin:8.0.4:compile (default-cli) @ test ---
[WARNING] GWT plugin is configured to detect modules, but none were found.
[INFO] Using com.vaadin:vaadin-client version 8.0.0
[INFO] Using com.vaadin:vaadin-client-compiler version 8.0.0
[INFO] ---------------------------------------------------------------------
[INFO] BUILD SUCCESS
我还尝试向VaadinUI类添加注释@Widgetset("AppWidgetset")
并重新编译,这次我在UI上出错:
Failed to load the widgetset: ./VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js?
所以,我在VaadinUi类附近添加了WidgetSet.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="com.vaadin.addon.charts.Widgetset" />
</module>
重新编译所有内容,但仍然可以
Failed to load the widgetset: ./VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js?
答案 0 :(得分:5)
添加vaadin client dep
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
答案 1 :(得分:0)
My POM as below and it worked. Build command as normal: mvn package. Only need to compile widget once so remove plugin when you build your app to reduce compile time. VAADIN folder to compile is at: \src\main\webapp\VAADIN
<!-- Only support to compile Vaadin widgetsets -->
.......
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
<version>8.2.0</version>
</dependency>
.....
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>8.2.0</version>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>