简体   繁体   中英

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. But now the project is under 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. Is the name specified as Class.getResource() would expect?

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.

In fact, I don't know where GWT looks for this resource. Maybe there's a solution on how to get the point where GWT starts looking resources for?

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/).

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.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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