Vaadin8迁移后的Vaadin Widgetset编译错误

时间:2017-05-02 13:44:19

标签: java maven gwt vaadin

我刚刚将我的Vaadin项目从7.7.6迁移到8.0.5。首先,我想使用Vaadin8迁移工具,但我的IDE使用了太多的vaadin。* import,所以我只是手动完成。经过几个小时的工作(兼容包导入)maven构建再次工作,我想在我的浏览器中打开WebApp但我得到了“无法加载Widgetset ...”错误消息。我以为我必须重新编译Widgetset但是vaadin-maven-plugin会抛出一个错误:

编辑04.05.2017:我删除了QueryDSL依赖项“querydsl-apt”并且widgetset正在编译......有谁知道为什么会这样?

c:\dev\workspace_intellij\wsi>mvn vaadin:compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wsi 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.querydsl:querydsl-core:jar:3.7.4 is missing, no dependency information available
[INFO]
[INFO] --- vaadin-maven-plugin:8.0.5:compile (default-cli) @ wsi ---
[INFO] auto discovered modules [WsiWidgetset]
[INFO] Using com.vaadin:vaadin-client-compiler version 8.0.5
[INFO] Compiling module WsiWidgetset
[INFO] [ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Error constructing Java AST
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.translateException(GwtAstBuilder.java:3944)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.getInternalCompilerException(GwtAstBuilder.java:4351)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMembers(GwtAstBuilder.java:4043)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3883)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3918)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:129)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:384)
[INFO]  at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1092)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:325)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:548)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:479)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:465)
[INFO]  at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:222)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:155)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:144)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO]  at com.google.gwt.dev.Compiler.main(Compiler.java:125)
[INFO] Caused by: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.lookup.MethodBinding.isDefaultMethod()Z
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMethod(GwtAstBuilder.java:4138)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.createMembers(GwtAstBuilder.java:4033)
[INFO]  ... 21 more
[INFO]    [ERROR] at SVGPathSegLinetoVerticalAbs.java(30): public interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg
[INFO]       org.eclipse.jdt.internal.compiler.ast.TypeDeclaration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.929 s
[INFO] Finished at: 2017-05-02T15:04:34+02:00
[INFO] Final Memory: 35M/434M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile (default-cli) on project wsi: Command [[
[ERROR] C:\Program Files\Java\jdk1.8.0_102\jre\bin\java -Xmx1G -Dgwt.persistentunitcache=false com.google.gwt.dev.Compiler -logLevel INFO -style OBF -war c:\dev\workspace_intellij\wsi\target\classes\VAADIN\widgetsets -localWorkers 4 -failOnError -XfragmentCount -1 -sourceLevel auto -gen c:\dev\workspace_intellij\wsi\target\.generated WsiWidgetset
[ERROR] ]] failed with status 1
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我的pom.xml看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    [...]

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>

        <vaadin.version>8.0.5</vaadin.version>
        <vaadin.plugin.version>8.0.5</vaadin.plugin.version>
        <vaadin.charts.version>4.0.0</vaadin.charts.version>
        <vaadin.spring.version>2.0.1</vaadin.spring.version>
        <vaadin.context.menu.version>2.0.0</vaadin.context.menu.version>
        <vaadin.fontawesome.version>1.3.4</vaadin.fontawesome.version>
        <vaadin.componentrenderer.version>2.0.0</vaadin.componentrenderer.version>

        [...]

    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>${vaadin.spring.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
        </dependency>

        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>fontawesomelabel</artifactId>
            <version>${vaadin.fontawesome.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-server-jndi</artifactId>
            <version>1.5.5</version>
        </dependency>

        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>4.0.1</version><!--$NO-MVN-MAN-VER$-->
        </dependency>

        <dependency>
            <groupId>org.imgscalr</groupId>
            <artifactId>imgscalr-lib</artifactId>
            <version>4.2</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-broker</artifactId>
        </dependency>

         <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-core</artifactId>
            <version>4.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>4.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>4.1.4</version>
        </dependency>

        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>mediaelementjs-player</artifactId>
            <version>1.3.3</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.patrik</groupId>
            <artifactId>GridFastNavigation</artifactId>
            <version>0.2.1</version>
        </dependency>

        <!-- Eigenes Kompilat, da Sourcen nicht attached waren -->
        <dependency>
            <groupId>org.vaadin.addons.lazyquerycontainer</groupId>
            <artifactId>vaadin-lazyquerycontainer</artifactId>
            <version>7.6.1.3</version>
        </dependency>

        <!-- WIDGETSET -->

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

        <dependency>
           <groupId>com.vaadin</groupId>
           <artifactId>vaadin-context-menu</artifactId>
           <version>${vaadin.context.menu.version}</version>
        </dependency>

        <dependency>
            <groupId>de.datenhahn.vaadin</groupId>
            <artifactId>componentrenderer</artifactId>
            <version>${vaadin.componentrenderer.version}</version>
        </dependency>

        <!-- WIDGETSET END -->

        [...]

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-server</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-client</artifactId>
        </dependency>

    </dependencies>

    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <!-- Clean up also any pre-compiled themes -->
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <!-- Exclude some unnecessary files generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**, WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>

                <configuration>
                    <extraJvmArgs>-Xmx1G</extraJvmArgs>
                </configuration>

                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-sources</outputDirectory>
                            <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    [...]

</project>

我的Widgetset.gwt.xml如下所示:

<?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>
    <!--
     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:
     ie8,ie9,gecko1_8,safari,opera

     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" /> -->

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

    <inherits name="com.vaadin.v7.Vaadin7WidgetSet" />

    <inherits name="com.vaadin.addon.charts.Widgetset"/>

    <inherits name="de.datenhahn.vaadin.componentrenderer.ComponentRendererWidgetSet"/>

    <inherits name="com.vaadin.contextmenu.WidgetSet" />

    <inherits name="org.vaadin.patrik.GridFastNavigation" />
</module>

有谁知道什么是错的?

祝你好运

2 个答案:

答案 0 :(得分:2)

通常NoSuchMethodError表示类路径问题,在编写代码时你的cp中有一个库(而你的IDE正在编译内联你的代码来检查它errors)是与maven编译时cp中的版本不同的版本。因此,在编译或运行代码时,不再能够找到编写代码时可用的方法(请参阅late binding)。

在您的特定情况下,由于使用JDT版本的QueryDSL依赖项,以及使用引用另一个JDT版本的GWT插件的Vaadin maven插件,这很可能是间接结果。

作为一种解决方法,您可以从QueryDSL版本或Vaadin maven插件explicitly exclude https://jsfiddle.net/zjet0432/1/ JDT传递依赖项,并尝试查看是否有效。

P.S。要查看究竟是谁正在引用JDT依赖关系,您可以运行mvn dependency:tree

答案 1 :(得分:0)

那有效&gt;非常感谢。我补充说:

 <exclusion>
    <groupId>org.eclipse.jdt.core.compiler</groupId>
    <artifactId>ecj</artifactId>
</exclusion>

在我的pom依赖中。