简体   繁体   中英

codehaus.mojo gwt-maven-plugin: project fails to compile

I would like to compile a GWT project in Eclipse.

I created the project using the gwt-maven-plugin archetype. My pom looks likt this:

<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>de.my.stuff</groupId>
    <artifactId>GWTAppProject</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>GWT Maven Archetype</name>

    <properties>
        <gwtVersion>2.7.0</gwtVersion>

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

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt</artifactId>
                <version>${gwtVersion}</version>
                <type>pom</type>
                <scope>import</scope>
            </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>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

        <plugins>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.7.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                            <goal>generateAsync</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <runTarget>GWTApp.html</runTarget>
                    <modules>
                        <module>de.my.stuff.GWTAppProject.GWTApp</module>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

When I run mvn clean install -U on this, I get the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.7.0:compile (default) on project GWTAppProjekt: Command [
[
[ERROR] C:\Java\JDK\jre\bin\java -Xmx512m -classpath D:\Workspaces\Eclipse\Eclipse_SE\GWTAppProject\target\GWTAppProject-0.0.
1-SNAPSHOT\WEB-INF\classes;D:\Workspaces\Eclipse\Eclipse_SE\GWTAppProject\src\main\java;D:\Workspaces\Eclipse\Eclipse_SE\GWTA
ppProjekt\target\generated-sources\gwt;D:\Maven_Local_Repository\com\google\gwt\gwt-user\2.7.0\gwt-user-2.7.0.jar;D:\Maven_Lo
cal_Repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar;D:\Maven_Local_Repository\javax\validatio
n\validation-api\1.0.0.GA\validation-api-1.0.0.GA-sources.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-dev\2.7.0\gwt-dev-
2.7.0.jar;D:\Maven_Local_Repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-util\5.0.3\
asm-util-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-tree\5.0.3\asm-tree-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\
asm\asm-commons\5.0.3\asm-commons-5.0.3.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-user\2.7.0\gwt-user-2.7.0.jar;D:\Mav
en_Local_Repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar;D:\Maven_Local_Repository\javax\vali
dation\validation-api\1.0.0.GA\validation-api-1.0.0.GA-sources.jar;D:\Maven_Local_Repository\com\google\gwt\gwt-dev\2.7.0\gwt
-dev-2.7.0.jar;D:\Maven_Local_Repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-util\5
.0.3\asm-util-5.0.3.jar;D:\Maven_Local_Repository\org\ow2\asm\asm-tree\5.0.3\asm-tree-5.0.3.jar;D:\Maven_Local_Repository\org
\ow2\asm\asm-commons\5.0.3\asm-commons-5.0.3.jar com.google.gwt.dev.Compiler -logLevel INFO -style OBF -war D:\Workspaces\Ecl
ipse\Eclipse_SE\GWTAppProject\target\GWTAppProject-0.0.1-SNAPSHOT -localWorkers 8 -XfragmentCount -1 -sourceLevel 1.8 -gen D:
\Workspaces\Eclipse\Eclipse_SE\GWTAppProject\target\.generated de.my.stuff.GWTAppProject.GWTApp
[ERROR] ]] failed with status 1

I have looked at other posts here on SO, but none of their solutions worked for me.

What is the error here?

GWT 2.7 does not support Java 8 source "level". Set maven.compiler.source and maven.compiler.target to 1.7 , or possibly the gwt-maven-plugin 's sourceLevel to 1.7 (if you're mixing server and client code in the same Maven module –bad idea– and want to use Java 8 on server-side), or use GWT 2.8.0-SNAPSHOT (2.8.0-beta-1 is in smoke-test and should be released in the coming days)

BTW, you should have had a more explicit error higher in your logs, about the unsupported -sourceLevel 1.8 value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM