error during vaadin widgetset compilation

2019-08-12 07:47发布

I have created component based on GWT

Component state

package com.game.quest.ui.gwt;

import com.vaadin.shared.AbstractComponentState;

import java.util.ArrayList;
import java.util.List;

public class LinePlotState extends AbstractComponentState {

    public List<DataSeries> series = new ArrayList<>();

    public static class DataSeries {
        public String label;
        public String color;
        public List<Float> data;
    }

}

Component connector

package com.game.quest.ui.gwt;

import ca.nanometrics.gflot.client.DataPoint;
import ca.nanometrics.gflot.client.SeriesHandler;
import ca.nanometrics.gflot.client.SimplePlot;

import com.game.quest.ui.gwt.LinePlotState.DataSeries;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;

@Connect(LinePlot.class)
public class LinePlotConnector extends AbstractComponentConnector {

    @Override
    public LinePlotState getState() {
        return (LinePlotState) super.getState();
    }

    @Override
    public SimplePlot getWidget() {
        return (SimplePlot) super.getWidget();
    }

    @Override
    protected Widget createWidget() {
        return GWT.create(SimplePlot.class);
    }

    @Override
    public void onStateChanged(StateChangeEvent stateChangeEvent) {
        super.onStateChanged(stateChangeEvent);

        getWidget().getModel().clear();
        for (DataSeries ds : getState().series) {

            SeriesHandler s = getWidget().getModel().addSeries(ds.label, ds.color);
            for (int i = 0; i < ds.data.size(); i++) {
                s.add(new DataPoint(i, ds.data.get(i)));
            }
        }
        getWidget().redraw();
    }

}

Component

package com.game.quest.ui.gwt;

import com.game.quest.ui.gwt.LinePlotState.DataSeries;
import com.vaadin.ui.AbstractComponent;

import java.util.Arrays;


public class LinePlot extends AbstractComponent {

    public LinePlot() {

    }

    public LinePlotState getState() {
        return (LinePlotState) super.getState();
    }

    public void addSeries(String label, String color, Float[] fs) {
        DataSeries ds = new DataSeries();
        ds.label = label;
        ds.color = color;
        ds.data = Arrays.asList(fs);
        getState().series.add(ds);
    }
}

I have created widgetset.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
    <inherits name="ca.nanometrics.gflot.GFlot" />
</module>

I put this file in resources folder of my project. I use gradle-vaadin-plugin for compilation

My build.gradle looks like this

apply plugin: 'com.bmuschko.tomcat'
apply plugin: 'java'
apply from: 'http://plugins.jasoft.fi/vaadin-groovy.plugin'

repositories {
    maven { url mavenRepoUrl }
    maven { url vaadinAddonsRepoUrl }
}

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "com.bmuschko:gradle-tomcat-plugin:${gradleTomcatPlugin}"
    }
}

allprojects {
    group='com.game.quest'
}

dependencies {

    compile "org.springframework:spring-core:${springMvcVersion}"
    compile "org.springframework:spring-web:${springMvcVersion}"
    compile "org.springframework:spring-webmvc:${springMvcVersion}"
    compile "com.vaadin:vaadin-client:${vaadinVersion}"
    compile "com.vaadin:vaadin-themes:${vaadinVersion}"
    compile "com.vaadin:vaadin-server:${vaadinVersion}"
    compile "com.vaadin:vaadin-client-compiled:${vaadinVersion}"
    compile "ru.xpoft.vaadin:spring-vaadin-integration:${vaadinSpringIntegrationAddonVersion}"
    compile "org.hibernate:hibernate-validator:4.2.0.Final"

    def tomcatVersion = '7.0.59'
    tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
           "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
           "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"

   compile "com.googlecode.gflot:gflot:${gFlotVersion}"
}

vaadin {
    version vaadinVersion
    widgetset 'Widgetset'
}

[tomcatRun, tomcatRunWar]*.configure {
    httpPort = 9080
    stopPort = 9081
}

But when I try to compile it I have this error

D:\work\test-workspace\TextQuestVaadin>gradlew vaadinCompileWidgetset --stacktrace
Using Gradle Vaadin Plugin 0.9.8
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:vaadinUpdateAddonStyles
:vaadinUpdateWidgetset
:processResources UP-TO-DATE
:classes UP-TO-DATE
:vaadinClassPathJar SKIPPED
:vaadinCompileWidgetset
Errors in 'com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java'
Line 28: Type mismatch: cannot convert from com.google.gwt.dom.client.Element to com.google.gwt.user.client.Element
Tracing compile failure path for type 'com.google.gwt.user.client.ui.impl.TextBoxImplIE6'
Errors in 'com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java'
Line 87: The method getTextAreaSelectionLength(Element) of type TextBoxImplIE6 must override or implement a supertype method

Line 27: The method getCursorPos(Element) of type TextBoxImplIE6 must override or implement a supertype method
Line 116: The method setSelectionRange(Element, int, int) of type TextBoxImplIE6 must override or implement a supertype meth
od
Line 40: The method getSelectionLength(Element) of type TextBoxImplIE6 must override or implement a supertype method
Line 59: The method getTextAreaCursorPos(Element) of type TextBoxImplIE6 must override or implement a supertype method
Tracing compile failure path for type 'com.google.gwt.user.client.impl.DOMImplOpera'
Errors in 'com/google/gwt/user/client/impl/DOMImplOpera.java'
Line 29: The method sinkEventsImpl(Element, int) of type DOMImplOpera must override or implement a supertype method
Tracing compile failure path for type 'com.google.gwt.user.client.ui.impl.ClippedImageImplIE6'
Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImplIE6.java'
Line 78: The method adjust(Element, SafeUri, int, int, int, int) in the type ClippedImageImpl is not applicable for the argu
ments (Element, String, int, int, int, int)
Line 136: The method getHTML(String, int, int, int, int) of type ClippedImageImplIE6 must override or implement a supertype
method
Line 118: The method fireSyntheticLoadEvent(Image) is undefined for the type ClippedImageImpl
Line 138: The method getHTML(String, int, int, int, int) is undefined for the type ClippedImageImpl
Line 105: The method createStructure(SafeUri, int, int, int, int) in the type ClippedImageImpl is not applicable for the arg
uments (String, int, int, int, int)
Line 75: The method adjust(Element, String, int, int, int, int) of type ClippedImageImplIE6 must override or implement a sup
ertype method
Line 110: The method createStructure(SafeUri, int, int, int, int) in the type ClippedImageImpl is not applicable for the arg
uments (String, int, int, int, int)
Line 102: The method createStructure(String, int, int, int, int) of type ClippedImageImplIE6 must override or implement a su
pertype method
Tracing compile failure path for type 'com.google.gwt.dom.client.DOMImplOpera'
Errors in 'com/google/gwt/dom/client/DOMImplOpera.java'
Line 21: The type DOMImplOpera must implement the inherited abstract method DOMImpl.createKeyCodeEvent(Document, String, boo
lean, boolean, boolean, boolean, int)
Line 21: The type DOMImplOpera must implement the inherited abstract method DOMImpl.createKeyEvent(Document, String, boolean
, boolean, boolean, boolean, boolean, boolean, int, int)
Line 21: The type DOMImplOpera must implement the inherited abstract method DOMImpl.createKeyPressEvent(Document, boolean, b
oolean, boolean, boolean, int)
Tracing compile failure path for type 'com.google.gwt.user.client.ui.impl.PopupImplIE6'
Errors in 'com/google/gwt/user/client/ui/impl/PopupImplIE6.java'
Line 86: The method setVisible(Element, boolean) of type PopupImplIE6 must override or implement a supertype method
Line 40: The method onShow(Element) of type PopupImplIE6 must override or implement a supertype method
Line 27: The method onHide(Element) of type PopupImplIE6 must override or implement a supertype method
Tracing compile failure path for type 'com.google.gwt.dom.client.DOMImplSafari'
Errors in 'com/google/gwt/dom/client/DOMImplSafari.java'
Line 21: The type DOMImplSafari must implement the inherited abstract method DOMImpl.createKeyCodeEvent(Document, String, bo
olean, boolean, boolean, boolean, int)
Line 21: The type DOMImplSafari must implement the inherited abstract method DOMImpl.createKeyPressEvent(Document, boolean,
boolean, boolean, boolean, int)
Tracing compile failure path for type 'com.google.gwt.dom.client.DOMImplIE6'
Errors in 'com/google/gwt/dom/client/DOMImplIE6.java'
Line 56: The method imgGetSrc(Element) of type DOMImplIE6 must override or implement a supertype method
Line 68: The method imgSetSrc(Element, String) of type DOMImplIE6 must override or implement a supertype method
Tracing compile failure path for type 'com.google.gwt.user.client.ui.impl.FocusImplOld'
Errors in 'com/google/gwt/user/client/ui/impl/FocusImplOld.java'
Line 91: The method setTabIndex(Element, int) of type FocusImplOld must override or implement a supertype method
Line 86: The method setAccessKey(Element, char) of type FocusImplOld must override or implement a supertype method
Line 76: The method focus(Element) of type FocusImplOld must override or implement a supertype method
Line 81: The method getTabIndex(Element) of type FocusImplOld must override or implement a supertype method
Line 36: The method blur(Element) of type FocusImplOld must override or implement a supertype method
Aborting compile due to errors in some input files
:vaadinCompileWidgetset FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':vaadinCompileWidgetset'.
> Widgetset failed to compile. See error log above.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':vaadinCompileWidgetset'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java
:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecut
er.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter
.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:
52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:
43)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.j
ava:79)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.j
ava:63)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.jav
a:90)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecute
r.java:50)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecute
r.java:27)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.api.GradleException: Widgetset failed to compile. See error log above.
        at fi.jasoft.plugin.tasks.CompileWidgetsetTask.run(CompileWidgetsetTask.groovy:166)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(Annotati
onProcessingTaskFactory.java:226)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annotation
ProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annotation
ProcessingTaskFactory.java:208)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:589)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:572)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:
80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java
:61)
        ... 49 more

Also after failed compilation my widgetset.gwt.xml looks like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
        <inherits name="com.vaadin.DefaultWidgetSet" />
        <set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
        <source path="client" />
        <source path="shared" />
        <collapse-all-properties />
        <set-property name="compiler.useSymbolMaps" value="true" />
</module>

My web.xml looks like this

<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:/spring-context.xml
        </param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>text-quest</servlet-name>
        <servlet-class>ru.xpoft.vaadin.SpringVaadinServlet</servlet-class>
        <init-param>
            <param-name>beanName</param-name>
            <param-value>textQuestUi</param-value>
        </init-param>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value></param-value>
        </init-param>
        <init-param>
            <param-name>widgetset</param-name>
            <param-value>Widgetset</param-value>    
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>text-quest</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>text-quest</servlet-name>
        <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping>

</web-app>

I use vaadinVersion=7.5.0.

What's the problem? As far as I can understand it's something with GWT?

1条回答
我命由我不由天
2楼-- · 2019-08-12 08:07

I ran into the same problem and solved it by increasing gwt version.

<dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt-user</artifactId>
    <version>2.7.0</version>
</dependency>
查看更多
登录 后发表回答