gpt4 book ai didi

maven - 为什么在 superdevmode 下重新编译 GWT 项目不会导致输出 javascript 代码发生变化?

转载 作者:行者123 更新时间:2023-12-01 09:13:01 26 4
gpt4 key购买 nike

我打算在 SuperDevMode 中调试 GWT Web 应用程序,我之前在 DevMode 中调试过该应用程序,以克服使用 GWT Elemental 库时内存使用量激增的问题。
到目前为止,我可以通过使用 Eclipse 运行配置或 mvn gwt:run 在浏览器中成功运行应用程序。使用 maven 作为我的代码服务器 ( mvn gwt:run-codeserver )。此时我的问题是,每当我对代码进行更改并使用“Dev Mode On”小书签中的“编译”按钮时,浏览器或源映射中的代码都不会发生更改。编译完成后,页面重新加载,对话框显示模块“可能需要(重新)编译”。为了刷新浏览器中的代码,我必须重新启动代码服务器。我的项目的 pom.xml 如下。

<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>mega-app</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.6.0</gwtVersion>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<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>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
<!-- Server protocol -->
<dependency>
<groupId>com.company.server</groupId>
<artifactId>server-lib</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.company.server</groupId>
<artifactId>server-lib</artifactId>
<version>0.0.1</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-elemental</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
</dependencies>

<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<versionRange>[2.4.0,)</versionRange>
<goals>
<goal>resources</goal>
<goal>compile</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>

<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
<runTarget>index.html</runTarget>
<module>com.company.App</module>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.company.web.client.Messages</i18nMessagesBundle>
<compileSourcesArtifacts>
<compileSourcesArtifact>com.company:protocol</compileSourcesArtifact>
</compileSourcesArtifacts>
</configuration>
</plugin>

<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version> <!-- Note 2.8 does not work with AspectJ aspect path -->
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>

</plugins>
</build>
</project>

提前感谢您提供我忽略的任何细节。

最佳答案

Here是 Thomas Broyer 的一篇文章,解释了 SuperDevMode 工作流程。

在浏览器的 DevTools 下的 Network 选项卡中,编译完成后是否有 Status Ok 的“gwtSourcemap.json”请求?

顺便说一句,如果您在服务器部分(不是 GWT 客户端部分)上进行更改,则必须在正常的 DevMode 上重新启动服务器。

希望能帮助到你。

关于maven - 为什么在 superdevmode 下重新编译 GWT 项目不会导致输出 javascript 代码发生变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22004383/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com