如何在Idea中调试GWT项目

问题描述 投票:0回答:1

我有一个用 GWT (2.10.0) + Spring Boot (2.7.x) 和 Java 8 编写的 Web 应用程序。我可以使用 Tomcat 配置 (9.0.80) 从 Idea 2022.1.4 运行我的应用程序,并且可以调试服务器端代码。现在我需要将客户端代码调试为 Java 代码。我尝试了多种选择但没有成功。

  1. 我创建了一个 GWT 配置(请参阅屏幕截图 #1)并尝试使用它运行我的应用程序,但我在日志中收到以下错误:
Loading modules
   com.myapp.MyApp
      Loading inherited module 'com.google.gwt.user.User'
         Loading inherited module 'com.google.gwt.core.Core'
            Loading inherited module 'com.google.gwt.emul.Emulation'
               Loading inherited module 'com.google.gwt.emul.Preconditions'
                  [ERROR] Element 'module' beginning on line 16 contains unexpected attribute 'type'
                  [ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)

GWT Configuration

  1. 我尝试的另一个选项是在运行/调试配置中创建应用程序启动器 Application configuration for DevMode。在这种情况下,我有一个不同的错误:
14:11:48.702 [main]  INFO  log - Logging initialized @2029ms to org.eclipse.jetty.util.log.Slf4jLog
   Loading Java files in MyApp.
   [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
Disconnected from the target VM, address: '127.0.0.1:62389', transport: 'socket'

Process finished with exit code 1

我在google搜索中发现这个异常可能是Idea中的一个错误,可能的修复方法是将

<property name="idea.dynamic.classpath.jar" value="false" />
添加到Idea的other.xml文件中。我这样做了,现在我的 other.xml 如下所示:

  <component name="PropertiesComponent">
    <property name="idea.dynamic.classpath.jar" value="false" />
    <property name="CWM_LOGGING_VERSION" value="1" />
    <property name="FindSplitterProportion" value="0.32956687" />

但是,这对我没有帮助,我仍然收到错误。 另外,

com.google.gwt.user.User
模块在我的MyApp.gwt.xml中继承,但我尝试显式添加
com.google.gwt.core.Core

有人知道我错过了什么吗?

java intellij-idea gwt
1个回答
0
投票

我发现我的项目有问题。最初,它是用 GWT 2.4.0 编写的,我最近迁移到了 GWT 2.10.0。我的 pom.xml 中的所有 GWT 依赖项均已升级到 2.10.0;但是,我发现项目设置 -> 模块 -> GWT 指向 2.4.0。我重新创建了 GWT 模块并选择 2.10.0。它解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.