Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT SuperDevMode fails to see changes

I'm trying to setup my project to use gwt maven plugin. Its compiling properly but I'm not able to use either the dev mode or super dev mode for development.

My settings are as follows:

Maven configurations in order

mvn clean install
mvn tomcat7:run-war-only
mvn gwt:run-codeserver

GWT Version: 2.6.1

IDE: Intellij 14 Community Edition

When I make changes to client java files and click the "compile" button on the code server page, they're not reflected on the webpage. I suspect the code server is not looking at the same sources I'm changing. Specifically i think its looking for sources to compile in target/{project-name}/*

Following is the snippet of the POM file I'm using.

    <sourceDirectory>src/main/java</sourceDirectory>
    <resources>
        <resource>
            <directory>src/main/java</directory>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>



    <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin.version}</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <!--compilerArgument>-proc:none</compilerArgument-->
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <path>${tomcat.context}</path>
                <port>${tomcat.webport}</port>
                <ajpPort>${tomcat.ajpport}</ajpPort>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>

        <!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${maven.gwt.plugin.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <draftCompile>true</draftCompile>
                <hostedWebapp>${webappDirectory}</hostedWebapp>
                <noServer>true</noServer>
                <port>${tomcat.webport}</port>
                <runTarget>${tomcat.context}/index.html</runTarget>
                <!--codeServerWorkDir>${webappDirectory}</codeServerWorkDir-->
                <copyWebapp>true</copyWebapp>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>exploded</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <webappDirectory>${webappDirectory}</webappDirectory>
            </configuration>
        </plugin>



    </plugins>

</build>

Any help would be appreciated!!

like image 798
BobLoblaw Avatar asked Mar 17 '23 16:03

BobLoblaw


2 Answers

Because you list src/main/java as a <resource>, its files are copied to the ${project.build.outputDirectory}, and that one comes first in the classpath because you could filter files from <resource> and have <source> and <resource> intersect (which is the case here). See http://jira.codehaus.org/browse/MGWT-290

So either:

  • remove src/main/java from project resources
  • remove *.java files from project resources (so at least they're not copied over to the output directory and don't shadow src/main/java)
  • or run mvn resources:resources each time you change files in src/main/java (like you have to do with files in src/main/resources, because of possible filtering); this can be automated by your IDE or some other tool (e.g. watchman) though.
like image 86
Thomas Broyer Avatar answered Mar 29 '23 08:03

Thomas Broyer


I would upgrade the project to use gwt-2.7.0 and gwt-maven-2.7.0, then nothing special is needed to run superdev mode among your app in a servlet container, just run mvn gwt:run and point your browser to http://localhost:8888, then each time you change your code just hit refresh in your browser to recompile the app.

As you can see it's pretty simpler, and you would take advance of recompiling in 2.7.0 is a lot faster.

like image 24
Manolo Carrasco Moñino Avatar answered Mar 29 '23 07:03

Manolo Carrasco Moñino