Search code examples
gwtgwt2

GWT @source annoation how to read from war folder?


May i know does @Source annotation only allow read file from src/package/client/* folder? can it read from /war/ folder?


Solution

  • @Source reads from the classpath at compile time.

    If you want/need to load resources that you don't want compiled into your JS, then use ScriptInjector or similar (RequestBuilder+StyleInjector or just dynamically adding a LinkElement to the DOM). If you want the ease of use of, say, ImageResource or CssResource, you could hand-write implementations rather than rely on the GWT generator. For CssResource, you could also simply use a dummy CSS stylesheet declaring all your classes as @external (and then injecting the CSS using either StyleInjector or a dynamic LinkElement).