javamavengwtgwt-maven-plugin

how to copy the static resource files in webapp folder automatically while debugging and on modification in a gwt maven project


I have a maven gwt web app.

Whenever I modify my html or css file while my gwt project is running the changes are not reflected in target folder which is a pain. Since I need to run gwt:run goal again by stopping the GWT super dev mode.

Is there a way these files will get automatically copied to the target folder on modification?

My maven build config currently looks like this:

<build>
    <!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" 
        update them in DevMode -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

    <plugins>

        <!-- Mojo's Maven Plugin for GWT -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.8.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                        <goal>generateAsync</goal>
                    </goals>
                </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                documentation at codehaus.org -->
            <configuration>
                <runTarget>JsInterOpHome.html</runTarget>
                <modules>
                    <module>com.ainosoft.jsInteropDemo.JsInterOpHome</module>
                </modules>
                <copyWebapp>true</copyWebapp>
                <generateJsInteropExports>true</generateJsInteropExports>
                <draftCompile>true</draftCompile>
            </configuration>
        </plugin>
    </plugins>
</build>

Solution

  • In most projects, mvn war:exploded will work. You can also try mvn package -Dgwt.compiler.skip.