eclipse:无法为gwt项目创建运行配置

时间:2015-11-12 18:31:27

标签: java eclipse gwt

我想从Eclipse启动一个GWT应用程序。但是,当我点击" Run As .."我没有任何选择,也无法创建运行配置。

我点了这个链接:

https://developers.google.com/eclipse/docs/running_and_debugging_2_0

但是,在我的GWT标签中,我无法改变任何内容。 " RUN"按钮永远不会激活。

为什么Eclipse不会自动将其识别为GWT项目?

我怎样才能让它发挥作用?

非常感谢!

修改

当我点击上下文菜单中的" GOOGLE" -Option并点击GWT COMPILE时,它说我的项目不是GWT项目。

我不明白。我使用mojo gwt maven插件创建它,我可以通过命令行启动它。

编辑2

<?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.abc</groupId>
    <artifactId>GWTProject</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>GWT Maven Archetype</name>

    <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.7.0</gwtVersion>

        <!-- GWT needs at least java 1.6 -->
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </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.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" 
            update them in DevMode -->
        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

        <plugins>

            <!-- GWT Maven Plugin -->
            <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>
                <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                    documentation at codehaus.org -->
                <configuration>
                    <runTarget>GWTProject.html</runTarget>
                    <modules>
                        <module>de.abc.GWTProject.GWTProject</module>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

错误是:

Missing required argument 'module[s]'
Google Web Toolkit 2.7.0

除了已经指定的

之外,哪些是模型
<modules>
    <module>de.abc.GWTProject.GWTProject</module>
</modules>

修改

在maven依赖项下,我有:

gwt-servlet-2.7.0.jar
gwt-user-2.7.0.jar
validation-api-1.0.0.GA.jar
gwt-dev-2.7.0.jar
a couple of jars beginning with asm-
junit
hamcrest

全部来自我当地的maven存储库。

我不会遇到一些编译错误吗?

1 个答案:

答案 0 :(得分:0)

右键点击您的项目

- &GT;属性 - &gt; Google - &gt; Web工具包

点击&#34;使用Google Web Toolkit&#34;复选框

并选择GWT SDK

右键点击您的项目

- &GT;属性 - &gt; Java构建路径

确保你有GWT sdk