【发布时间】:2018-01-24 06:58:40
【问题描述】:
我正在使用 Eclipse Neon 并从市场安装了 GWT Eclipse 插件。 我点击 New-> New GWT web application 并选择了 'Generate a maven project' 和 'Generate project sample code' 复选框
文件夹结构类似
我正在尝试在客户端文件夹中创建一个新类。但它显示一个错误,如“源文件夹不属于 GWT 项目”。我无法浏览到所需的文件夹。它只显示 src/main/java。我是 GWT 的新手
我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/maven-v4_0_0.xsd">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.asayama.docs.gwt.angular.examples</groupId>
<artifactId>Gwt_angular_examples</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>com.asayama.docs.gwt.angular.examples.Gwt_angular_examples</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.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>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-codeserver</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.asayama.gwt.angular</groupId>
<artifactId>gwt-angular-ng</artifactId>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-codeserver</artifactId>
<version>${gwtVersion}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-source</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/com/asayama/docs/gwt/angular/site/examples/public/src/</outputDirectory>
<resources>
<resource>
<directory>src</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
【问题讨论】:
-
src/main/java在项目的构建路径上吗? -
是的,它在构建路径中
-
您的
.gwt.rpc文件是否包含<source path="client" />之类的行? -
不是 .gwt.rpc,但 .gwt.xml 文件包含类似
的条目 -
我的错,是的,我想说
.gwt.xml。项目属性/Google/Web 工具包:“入口点模块”部分有什么内容吗?