简体   繁体   English

如何在开发人员模式下启动GWT调试

[英]How to launch GWT debug in dev mode

Before migrating to maven, we used Ant and there were no problems with launching Dev Mode from under IntelliJ IDEA. 在迁移到Maven之前,我们使用过Ant,并且从IntelliJ IDEA下启动开发模式没有问题。 But now the project is under Maven. 但是现在该项目在Maven之下。 So I made, I think, all needed configuration, and when I run debugger I see login page, but after logging in I receive the following error: 因此,我认为所有必需的配置均已完成,并且在运行调试器时看到登录页面,但登录后收到以下错误:

[ERROR] Resource img/remove_filter_btn.png not found. [错误]找不到资源img / remove_filter_btn.png。 Is the name specified as Class.getResource() would expect? 是否将名称指定为Class.getResource()?

Here is how I use resource: 这是我使用资源的方式:

public interface Resources extends ClientBundle {

    @Source("img/remove_filter_btn.png")
    ImageResource removeBtn();
}

The project structure is the following: 项目结构如下:

Module
|--Submodule
|  |--src
|  | |--main
|  | | |--java
|  | |   |--package
|  | |     |--class
|  | |--webapp
|  |   |--img
|  |     |--remove_filter_btn.png
|  |--target
|    |--ROOT
|      |--img
|        |--remove_filter_btn.png
|--utils
   |--tomcat
      |--webapps
         |--ROOT
            |--img
               |--remove_filter_btn.png

War file is launched in tomcat that is located in utils folder. War文件在utils文件夹中的tomcat中启动。

In fact, I don't know where GWT looks for this resource. 实际上,我不知道GWT在哪里寻找该资源。 Maybe there's a solution on how to get the point where GWT starts looking resources for? 也许有一种解决方法可以解决GWT开始寻找资源的问题?

At the moment this is the only question because i think that it is the only left issue before debug would start working. 目前这是唯一的问题,因为我认为这是调试开始工作之前唯一剩下的问题。

The images consumed by ClientBundle into ImageResource s are expected to be in the source tree, not in the external web resources (ie in target/ or webapp/). ClientBundle消耗到ImageResource的图像应该在源树中,而不是在外部Web资源中(即target /或webapp /中)。

When you write 当你写

package my.project.something.client
//...
public interface Resources extends ClientBundle {
    @Source("img/remove_filter_btn.png")
    ImageResource removeBtn();
}

you are telling ClientBundle that it can find the image at src/my/project/something/client/img/remove_filter_btn.png. 您告诉ClientBundle,它可以在src / my / project / something / client / img / remove_filter_btn.png中找到图像。

Keep in mind that the purpose of ClientBundle isn't just to wrap up pathname strings so they can be easily used in code, but to actually compile the image into your app. 请记住,ClientBundle的目的不仅仅是包装路径名字符串,以便它们可以轻松地在代码中使用,而且实际上是将图像编译到您的应用程序中。 In the case of small images, it will often actually put the entire image into the app so there is no need for any spriting at all. 对于小图像,它通常实际上会将整个图像放入应用程序中,因此根本不需要任何拼版。 Even if this isn't possible, it will still rewrite the images so they can be cached forever by the browser, and try to optimize them to not use any more space than actually needed. 即使不可能,它仍会重写图像,以便浏览器可以将其永久缓存,并尝试对其进行优化,以使其不使用超出实际需要的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM