GWT 超级开发模式不编译最新源代码



我有一个使用 GWT 2.7.0 的 GWT 项目,并且正在使用 maven。该应用程序正在正确编译和运行,但是,我正在努力使GWT的超级开发模式正常工作。当我启动超级开发模式时

mvn gwt:run-codeserver

超级开发模式正确启动、编译,最新更改显示在浏览器中。但是,当我按下编译书签重新编译 GWT 代码时,重新编译正确完成,浏览器刷新,但不包括我对客户端/GWT java 文件所做的任何后续更改。

启动GWT超级开发模式时,它似乎将源文件(.java文件(从src/main/java复制到maven的构建文件夹(目标(,并且它似乎是从目标文件夹中的源文件而不是src/main/java中的源文件进行编译。我已经通过手动将我所做的更改的 java 文件从 src/main/java 复制到目标文件夹,然后点击编译书签来测试这一点。当我这样做时,重新编译像以前一样成功,并显示最新的更改。

我假设我错过了一些配置,每当我点击编译书签时,这些配置都会将 src/main/java 复制到目标文件夹中,或者我错误地配置了超级开发模式以从目标文件夹编译,而它应该从 src/main java 中的源代码编译

任何有助于了解它应该如何运作并解决此问题的帮助将不胜感激。

我的pom的相关部分.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><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>
...
<packaging>war</packaging>
<version>0.1.0.BUILD-SNAPSHOT</version>
...
<properties>
<java.version>7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.12</slf4j.version>
<spring.version>4.2.2.RELEASE</spring.version>
<spring-security.version>3.2.8.RELEASE</spring-security.version>
<spring-data.version>1.9.0.RELEASE</spring-data.version>
<spring.integration.version>4.2.0.RELEASE</spring.integration.version>
<hazelcast.version>3.6.4</hazelcast.version>
<aspectj.version>1.8.5</aspectj.version>
<gwt.version>2.7.0</gwt.version>
<cucumber.version>1.2.4</cucumber.version>
<togglz.version>2.1.0.Final</togglz.version>
<apache.poi.version>3.16</apache.poi.version>
<skipTests>true</skipTests>
</properties>
<repositories>
<repository>
<id>spring-maven-release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>spring-maven-milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>maven.springframework.org.external</id>
<url>http://maven.springframework.org/external</url>
<name>SpringSource Maven Repository - External Releases</name>
</repository>
<repository>
<id>ailis-releases</id>
<name>Ailis Maven Releases</name>
<url>http://nexus.ailis.de/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-maven-release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</pluginRepository>
<pluginRepository>
<id>spring-maven-milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<!-- Spring dependencies -->
...
<!-- General dependencies -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- GWT dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>com.google.gwt.eventbinder</groupId>
<artifactId>eventbinder</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.google.gwt.google-apis</groupId>
<artifactId>gwt-visualization</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
<build>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- Clean -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/app</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- War -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<!-- Aspectj -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<!-- NB: do not use 1.3 or 1.3.x due to MASPECTJ-90 issue  -->
<dependencies>
<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>${java.version}</source>
<target>${java.version}</target>
<!--
Aspects in src/main/java and src/main/aspects are added
as default in the compile goal.
Aspects in src/getAllClients/java and src/getAllClients/aspects are added
as default in the getAllClients-compile goal.
Aspects in src/main/java are added in the getAllClients-compile
goal if weaveWithAspectsInMainSourceFolder is set to true
-->
<weaveWithAspectsInMainSourceFolder>false</weaveWithAspectsInMainSourceFolder>
</configuration>
</plugin>
<!-- Resources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.outputDirectory}/za/co/shared/domain/i18n
</outputDirectory>
<resources>
<resource>
<directory>src/main/java/za/co/shared/domain/i18n</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Assembly -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!-- Deploy -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<!-- Tomcat -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/app</path>
</configuration>
</plugin>
<!-- GWT -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<configuration>
<logLevel>INFO</logLevel>
<style>PRETTY</style>
<runTarget>/app</runTarget>
<modules>
<module>${project.groupId}.app</module>
</modules>
<extraJvmArgs>-XX:MaxPermSize=2048m -Xmx2048m</extraJvmArgs>
<localWorkers>1</localWorkers>
<inplace>true</inplace>
<noServer>true</noServer>
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<compilerMetrics>false</compilerMetrics>
<i18nConstantsBundle>za.co.shared.domain.i18n.GlobalConstants</i18nConstantsBundle>
</configuration>
<executions>
<execution>
<id>gwt-compile-on-package</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>gwt-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
<execution>
<id>gwt-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

https://tbroyer.github.io/gwt-maven-plugin/codeserver.html

从 GWT 2.7 开始,您应该设置launcherDir属性以在重新加载时重新编译。该属性应指向您的 Web 服务器/servlet 容器将查找 Web 资源的文件夹,以便 Web 浏览器可以加载 CodeServer 生成的*.nocache.js文件。

有时我遇到这些问题,我按照以下步骤操作: 1.清除浏览器缓存 2.清除位于临时文件夹(USER_HOME文件夹中,它基于您的操作系统(和gwt-unitCache文件夹(在launcherDir中(中的GWT缓存

最新更新