java - codehaus.mojo gwt-maven-plugin:项目无法编译

原文 标签 java eclipse maven gwt

我想在Eclipse中编译一个GWT项目。

我使用gwt-maven-plugin原型创建了项目。我的pom看起来有点:

<?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>


当我对此运行mvn clean install -U时,出现以下错误:

[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


我在SO上看过其他文章,但是他们的解决方案都不适合我。

这是什么错误?

最佳答案

GWT 2.7不支持Java 8源“级别”。将maven.compiler.sourcemaven.compiler.target设置为1.7,或者将gwt-maven-pluginsourceLevel设置为1.7(如果您在同一Maven模块中混合服务器和客户端代码–不好的主意–并且想要在服务器端使用Java 8),或使用GWT 2.8.0-SNAPSHOT(2.8.0-beta-1正在冒烟测试中,应在未来几天内发布)

顺便说一句,关于不支持的-sourceLevel 1.8值,您应该在日志中出现一个更明确的错误。

关于java - codehaus.mojo gwt-maven-plugin:项目无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33653943/

相关文章:

java - 为什么在不注册可调用语句的情况下IN OUT参数返回值?

java - 在JavaScript和Servlet之间通信

java - 默认获取Android手机号码

java - 即使在 list 中声明了 Activity ,也找不到 Activity 异常

java - JSON响应数据进入控制台时,我使用Java,Eclipse,Tomcat

java - javax.ws.rs.NotFoundException:找不到完整路径的资源:使用RESTEasy,Eclipse Luna和Tomcat 7

maven - 我们怎么知道我们可以信任 Maven 中央存储库?

java - 在Java中使用JSch在服务器上创建嵌套目录

java - 在Play 2框架(Java)中,如何在身份验证后将User对象添加到 session 中

java - Spring 4.0.1 + quartz 1.5.2