GWT: создание проекта GWT / Polymer с Maven

Я следую следующему учебнику для GWT и polymer: http://www.gwtproject.org/doc/latest/polymer-tutorial/introduction.html . Сейчас я пытаюсь создать проект todo. Когда я иду, чтобы запустить проект (с mvn gwt:run), я получаю следующую ошибку / трассировку стека, хотя:

  [ERROR] Source level must be one of [auto, 1.8].
    [ERROR] Google Web Toolkit 2.8.0
    [ERROR] DevMode [-[no]startServer] [-port port-number | "auto"] [-logdir directory] [-logLevel (ERROR|WARN|INFO|TRACE|DEBUG|SPAM|ALL)] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-[no]superDevMode] [-server servletContainerLauncher[:args]] [-startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-modulePathPrefix ] [-workDir dir] [-XmethodNameDisplayMode (NONE|ONLY_METHOD_NAME|ABBREVIATED|FULL)] [-sourceLevel [auto, 1.8]] [-[no]generateJsInteropExports] [-[no]incremental] [-style (DETAILED|OBFUSCATED|PRETTY)] [-[no]failOnError] [-setProperty name=value,value...] module[s]
    [ERROR]
    [ERROR] where
    [ERROR]   -[no]startServer               Starts a servlet container serving the directory specified by the -war flag. (defaults to ON)
    [ERROR]   -port                          Specifies the TCP port for the embedded web server (defaults to 8888)
    [ERROR]   -logdir                        Logs to a file in the given directory, as well as graphically
    [ERROR]   -logLevel                      The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)
    [ERROR]   -gen                           Debugging: causes normally-transient generated types to be saved in the specified directory
    [ERROR]   -bindAddress                   Specifies the bind address for the code server and web server (defaults to 127.0.0.1)
    [ERROR]   -codeServerPort                Specifies the TCP port for the code server (defaults to 9997 for classic Dev Mode or 9876 for Super Dev Mode)
    [ERROR]   -[no]superDevMode              Runs Super Dev Mode instead of classic Development Mode. (defaults to ON)
    [ERROR]   -server                        Specify a different embedded web server to run (must implement ServletContainerLauncher)
    [ERROR]   -startupUrl                    Automatically launches the specified URL
    [ERROR]   -war                           The directory into which deployable output files will be written (defaults to 'war')
    [ERROR]   -deploy                        The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar)
    [ERROR]   -extra                         The directory into which extra files, not intended for deployment, will be written
    [ERROR]   -modulePathPrefix              The subdirectory inside the war dir where DevMode will create module directories. (defaults empty for top level)
    [ERROR]   -workDir                       The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)
    [ERROR]   -XmethodNameDisplayMode        EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)
    [ERROR]   -sourceLevel                   Specifies Java source level (defaults to 1.8)
    [ERROR]   -[no]generateJsInteropExports  Generate exports for JsInterop purposes (defaults to OFF)
    [ERROR]   -[no]incremental               Compiles faster by reusing data from the previous compile. (defaults to ON)
    [ERROR]   -style                         Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)
    [ERROR]   -[no]failOnError               Fail compilation if any input file contains an error. (defaults to OFF)
    [ERROR]   -setProperty                   Set the values of a property in the form of propertyName=value1[,value2...].
    [ERROR] and
    [ERROR]   module[s]                      Specifies the name(s) of the module(s) to host
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.068 s
    [INFO] Finished at: 2016-11-09T11:42:07-05:00
    [INFO] Final Memory: 17M/230M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.8.0:run (default-cli) on project TodoList: Command [[
    [ERROR] cmd.exe /X /C "C:Promevojdk1.7.0_25jrebinjava -Xmx512m com.google.gwt.dev.DevMode -gen C:Userstyler.hilbertDocumentsTodoListApptarget.generated -war C:Userstyler.hilbertDocumentsTodoListApptargetTodoList-1.0-SNAPSHOT -logLevel INFO -port 8888 -codeServerPort 9997 -startupUrl TodoList.html -sourceLevel 1.7 org.gwtproject.tutorial.TodoList"
    [ERROR] ]] failed with status -1

Мой пом.xml-файл выглядит следующим образом:

<?xml version="1.0" encoding="UTF-8"?>
<project  
    xsi_schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <!-- POM file generated with GWT webAppCreator -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.gwtproject.tutorial</groupId>
    <artifactId>TodoList</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>org.gwtproject.tutorial.TodoList</name>

    <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.8.0</gwtVersion>
        <!-- Note: GWT needs at least java 1.6 -->
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- ensure all GWT deps use the same version (unless overridden) -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt</artifactId>
                <version>${gwtVersion}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-codeserver</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.vaadin.polymer/vaadin-gwt-polymer-elements -->
        <dependency>
            <groupId>com.vaadin.polymer</groupId>
            <artifactId>vaadin-gwt-polymer-elements</artifactId>
            <version>1.7.0.0</version>
        </dependency>

    </dependencies>

    <build>

        <plugins>

            <!-- GWT Maven Plugin -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwtVersion}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <!-- Run tests through gwt:test, this allows reusing the plugin configuration 
                            for GWTTestCases -->
                        <id>gwt-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                    documentation at codehaus.org -->
                <configuration>
                    <jsInteropMode>JS</jsInteropMode>
                    <modules>
                        <module>org.gwtproject.tutorial.TodoList</module>
                    </modules>
                    <!-- URL that should be opened by DevMode (gwt:run). -->
                    <runTarget>TodoList.html</runTarget>
                    <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
                    <compileReport>true</compileReport>
                    <!-- Run tests using HtmlUnit -->
                    <mode>htmlunit</mode>
                    <!-- Tests patterns -->
                    <includes>**/Test*.java,**/*Test.java,**/*TestCase.java</includes>
                </configuration>
            </plugin>

            <!-- Skip normal test execution, we use gwt:test instead -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

            <!-- NOTE: this is only needed if you use "mvn eclipse:eclipse". -->
            <!-- You can remove this plugin if you intend to only use the Maven integration 
                in Eclipse, or another IDE -->
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.7</version>  <!-- Note 2.8 does not work with AspectJ aspect path -->
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                    <wtpversion>2.0</wtpversion>
                    <additionalBuildcommands>
                        <buildCommand>
                            <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
                        </buildCommand>
                    </additionalBuildcommands>
                    <additionalProjectnatures>
                        <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
                    </additionalProjectnatures>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

Как правильно запустить проект?

1 ответ

  1. Я изменил следующие строки:

    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    

    к этому и пристроился:

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>