maven - GWT Super Dev Mode 不编译最新资源

标签 maven gwt gwt-super-dev-mode

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

启动 super 开发模式时
mvn gwt:run-codeserver

Super Dev Mode 正确启动、编译,最新的更改显示在浏览器中。然而,当我按下编译小书签重新编译 GWT 代码时,重新编译正确完成并且浏览器刷新但不包括我对客户端/GWT Java 文件所做的任何后续更改。

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

我假设我错过了一些配置,这些配置会在我点击编译书签时将 src/main/java 复制到目标文件夹中,或者我错误地将 Super Dev Mode 配置为从目标文件夹编译,而它应该从目标文件夹编译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

Starting with GWT 2.7, you should set the launcherDir property to get recompile on reload. The property should point to a folder that your web server / servlet container will look into for web resources, so that the *.nocache.js file generated by the CodeServer can be loaded by your web browser.

关于maven - GWT Super Dev Mode 不编译最新资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50271843/

相关文章:

gwt - 如何在 GWT 2.7 应用程序中启用生产模式

maven - 在 Maven 发布期间跳过子模块

maven - Intellij 不支持 maven-compiler-plugin

java - GWT ListBox 默认未选中

gwt - 使复合小部件可拖动时出现问题

java - 如何使 GWT super 开发模式在 HTML iframe 内的 GWT 元素上工作?

java - GWT 2.7.0 Super Dev Mode,更改后不要重新编译服务器端代码

java - Maven访问gcloud

java - Maven Hibernate 依赖项

java - com.google.gwt.user.client.ui.DeckPanel 可以触发哪些事件?