Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT + Eclipse - how to refresh static resources such as CSS

Tags:

css

gwt

I am developing GWT application in Eclipse in Hosted mode.

When I change something in CSS I cant see it in browser. I am trying full reload in browser using CTRL+F5, restarting my App in Eclipse and no change.

Only thing which helps is rebuild my app using maven clean install, restart App in Eclipse and then i can see changes. This takes a lot of time.

Any idea what I am doing wrong? I think there must be better way.

regards,Lukas

like image 279
Gondri Avatar asked Aug 15 '12 13:08

Gondri


2 Answers

The problem is that in dev mode the src webapp folder copied to target only at startup, and DevMode does not refresh it. As a workaround you can use copy-resources, that take care of applying changes on the fly.

    <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
            <execution>
                <id>copy-resources</id>
                <phase>validate</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <outputDirectory>${project.build.directory}/gwt-webapp</outputDirectory>
                    <resources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <filtering>true</filtering>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>
like image 149
Daniel Hári Avatar answered Sep 17 '22 23:09

Daniel Hári


I use an external CSS file for my app, and I immediately see all changes in my browser upon simple refresh (no emptying cache, server restart, etc.) in both Chrome and Firefox.

The problem may be related to the location of your file. My file is in the /war directory, and I edit it directly. Another possibility is how you reference your file in your host page. Make sure you have a relative path like "/myCss.css".

like image 43
Andrei Volgin Avatar answered Sep 19 '22 23:09

Andrei Volgin