我想将日历(https://vaadin.com/directory/component/calendar-add-on)添加到我的项目中。因此,我已将依存关系添加到pom.xml中。
当我使用日历组件运行项目时,出现错误,组件在哪里:


  Widgetset'com.vaadin.DefaultWidgetSet'不包含
  org.vaadin.addon.calendar.Calendar的网站:vaadin.com


我读过某个地方,我需要在配置中添加“不存在的模块”,然后编译widgetset。
所以我做到了,现在当我编译widgetset时,它给了我一个JS解析器错误。
难道我做错了什么?
这是widgetset的编译输出:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building portal 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- vaadin-maven-plugin:8.2.0:update-widgetset (default-cli) @ portal ---
[INFO] Updating widgetset non-existing-module
[INFO] Adding resource directory to command classpath: C:\Users\Michu\SWZTZ\portal\src\main\resources
[INFO] Adding resource directory to command classpath: C:\Users\Michu\SWZTZ\portal\src\main\resources
[INFO] Widgetsets found from classpath:
[INFO] org.vaadin.addon.calendar.WidgetSet in jar:file:C:/Users/Michu/.m2/repository/org/vaadin/blackbluegl/calendar-component/2.0-BETA3/calendar-component-2.0-BETA3.jar!/
[INFO] com.vaadin.DefaultWidgetSet in jar:file:C:/Users/Michu/.m2/repository/com/vaadin/vaadin-client/8.2.0/vaadin-client-8.2.0.jar!/
[INFO] Addon styles found from classpath:
[INFO] VAADIN/addons/calendar/calendar-addon.scss in jar:file:C:/Users/Michu/.m2/repository/org/vaadin/blackbluegl/calendar-component/2.0-BETA3/calendar-component-2.0-BETA3.jar!/
[INFO]
[INFO] Search took 8ms
[INFO]
[INFO] --- vaadin-maven-plugin:8.2.0:compile (default-cli) @ portal ---
[INFO] Compiling module non-existing-module
[INFO] Computing all possible rebind results for 'com.vaadin.client.metadata.ConnectorBundleLoader'
[INFO] Rebinding com.vaadin.client.metadata.ConnectorBundleLoader
[INFO] Invoking generator com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory
[INFO] Populating eager bundle
[INFO] Visiting DataCommunicatorConnector with ConnectorInitVisitor
[INFO] DataCommunicatorConnector will be in the eager bundle
[INFO] Will serialize class com.vaadin.shared.extension.datacommunicator.DataCommunicatorState as a bean
[INFO] Will serialize class com.vaadin.shared.communication.URLReference using URLReference_Serializer

(...)

[INFO] Populating CalendarConnector bundle
[INFO] Visiting CalendarConnector with ConnectorInitVisitor
[INFO] CalendarConnector will be in the org.vaadin.addon.calendar.client.CalendarConnector bundle
[INFO] Will serialize class org.vaadin.addon.calendar.client.CalendarState as a bean
[INFO] Will serialize class org.vaadin.addon.calendar.client.CalendarState.ItemSortOrder as an enum
[INFO] Will serialize class org.vaadin.addon.calendar.client.CalendarState.Item as a bean
[INFO] Will serialize class org.vaadin.addon.calendar.client.CalendarState.Day as a bean
[INFO] Will serialize class org.vaadin.addon.calendar.client.CalendarState.Action as a bean
[INFO] Computing all possible rebind results for 'com.vaadin.client.ui.dd.VAcceptCriterionFactory'
[INFO] Rebinding com.vaadin.client.ui.dd.VAcceptCriterionFactory
[INFO] Invoking generator com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator
[INFO] Detecting available criteria ...
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.AcceptAll
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.And
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIs
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Not
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Or
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ServerSideCriterion
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIsTarget
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.TargetDetailIs
[INFO] Done. (0seconds)
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 64,335s
[INFO] Linking into C:\Users\Michu\SWZTZ\portal\src\main\webapp\VAADIN\widgetsets\non-existing-module; Writing extras to C:\Users\Michu\SWZTZ\portal\target\extra\non-existing-module
[INFO] Invoking Linker Cross-Site-Iframe
[INFO] Attempting to optimize JS
[INFO] [ERROR] Unable to parse JavaScript
[INFO] com.google.gwt.dev.js.JsParserException: StandardLinkerContext.optimizeJavaScript(17): missing ( before function parameters
[INFO] > function non-existing-module() {
[INFO] > -------------^
[INFO] at com.google.gwt.dev.js.JsParser$1.error(JsParser.java:111)
[INFO] at com.google.gwt.dev.js.rhino.Context.reportError(Context.java:459)
[INFO] at com.google.gwt.dev.js.rhino.TokenStream.reportSyntaxError(TokenStream.java:1594)
[INFO] at com.google.gwt.dev.js.rhino.Parser.reportError(Parser.java:72)
[INFO] at com.google.gwt.dev.js.rhino.Parser.mustMatchToken(Parser.java:64)
[INFO] at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:189)
[INFO] at com.google.gwt.dev.js.rhino.Parser.parse(Parser.java:116)
[INFO] at com.google.gwt.dev.js.JsParser.parseImpl(JsParser.java:133)
[INFO] at com.google.gwt.dev.js.JsParser.parse(JsParser.java:88)
[INFO] at com.google.gwt.dev.js.JsParser.parseInto(JsParser.java:93)
[INFO] at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.optimizeJavaScript(StandardLinkerContext.java:443)
[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.generateSelectionScript(SelectionScriptLinker.java:428)
[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.generateSelectionScript(SelectionScriptLinker.java:416)
[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.emitSelectionScript(SelectionScriptLinker.java:310)
[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.link(SelectionScriptLinker.java:212)
[INFO] at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeFinalLink(StandardLinkerContext.java:339)
[INFO] at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:459)
[INFO] at com.google.gwt.dev.Link.link(Link.java:178)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:244)
[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] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:15 min
[INFO] Finished at: 2018-01-02T16:35:07+01:00
[INFO] Final Memory: 34M/363M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.2.0:compile (default-cli) on project portal: Command [[
[ERROR] C:\Program Files\Java\jdk1.8.0_112\jre\bin\java -Xmx1G -Dgwt.persistentunitcache=false com.google.gwt.dev.Compiler -logLevel INFO -style OBF -war C:\Users\Michu\SWZTZ\portal\src\main\webapp\VAADIN\widgetsets -localWorkers 8 -failOnError -compileReport -XfragmentCount -1 -sourceLevel auto -extra C:\Users\Michu\SWZTZ\portal\target\extra -gen C:\Users\Michu\SWZTZ\portal\target\.generated non-existing-module
[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>

    <groupId>pl.swztz</groupId>
    <artifactId>portal</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>portal</name>
    <description>Portal SWZTZ</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <vaadin.version>8.2.0</vaadin.version>
    </properties>

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

    <dependencies>
        <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-data-jpa</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>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
               <groupId>org.vaadin.addon</groupId>
               <artifactId>confirmdialog</artifactId>
               <version>3.2.0</version>
        </dependency>
        <dependency>
               <groupId>org.vaadin.blackbluegl</groupId>
               <artifactId>calendar-component</artifactId>
               <version>2.0-BETA3</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiler</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
    </dependencies>

    <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>
        <finalName>PortalSWZTZ</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.0.0</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>src/main/webapp/VAADIN/widgetsets</directory>
                            </fileset>
                            <fileset>
                                <directory>src/main/webapp/VAADIN/gwt-unitCache</directory>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-maven-plugin</artifactId>
                    <version>${vaadin.version}</version>
                    <configuration>
                        <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
                        <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
                        <noServer>true</noServer>
                        <draftCompile>false</draftCompile>
                        <style>OBF</style>
                        <strict>true</strict>
                        <compileReport>true</compileReport>
                        <runTarget>http://localhost:8080/</runTarget>
                        <modules>
                            <module>non-existing-module</module>
                        </modules>
                    </configuration>
                    <executions>
                        <execution>
                            <configuration>
                                <skipTests>${skipTests}</skipTests>
                            </configuration>
                            <goals>
                                <goal>resources</goal>
                                <goal>update-widgetset</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

最佳答案

好。工作正常!
我将pom中的“不存在的模块”更改为“ MyWidgetset.Widgetset.gwt.xml”,然后将注释@Widgetset(“ MyWidgetset.Widgetset.gwt.xml”)添加到UI类。

09-30 09:58