4

We decided to use gwt modules in our application about 1 week ago. We use gwt-maven-eclipse trio and we already configured phases and goals. Also we are doing context deploying to decrease development and testing time.

BUT;

When we package or tomcat:deploy our application, gwt modules are re-compiling(including unchanged ones).

<set-property name="user.agent" value="gecko1_8"></set-property>
<extend-property name="locale" values="en_UK"></extend-property>

I already set these properties up here to speed up compiling time but this is not what i want exactly... I also configured maven lifecycle mapping in eclipse to fire gwt:compile process-resources resources:testResources when any resources change. But it blocks eclipse and that was not helpful about compiling time either.

This is gwt-maven-plugin configuration in pom.xml

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.3.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <!--
                    Plugin configuration. There are many available options, see
                    gwt-maven-plugin documentation at codehaus.org
                -->
                <configuration>
                    <runTarget>A.jsp</runTarget>
                    <runTarget>B.jsp</runTarget>
                    <hostedWebapp>${webappDirectory}</hostedWebapp>
                </configuration>
            </plugin>

Any idea to help me?

Çağdaş
  • 993
  • 1
  • 12
  • 33

1 Answers1

5

gwt-maven-plugin tries (hard) to avoid recompiling modules when the code hasn't changed, but even that takes a bit of time (still less than re-compiling the module; and unfortunately if it detects the module needs to be recompiled, it adds up to the GWT compile time).

If you know you don't need gwt:compile, you can pass -Dgwt.compiler.skip=true to your Maven build to skip the goal and keep "running" your previously compiled code. Similarly, if you know you need gwt:compile, you can pass -Dgwt.compiler.force=true to bypass the "up-to-date check".

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • well i'm trying to avoid **"knowing"** which part of gwt resources has changed or not. For example if I put a new break in a .gwt.xml file it re-compiles other modules too. My question is about how can handle this if i have N modules? Or how you handle compiling process if you have a lot of modules? – Çağdaş Jul 05 '11 at 09:07
  • As I understand it, the gwt-maven-plugin should only recompile those apps that have changed, i.e. the gwt.xml you modified (if it's an app), or one that `` it (if it's more a library). BTW, GWT 2.5 (I believe it'll be disabled in 2.4) will allow you to "precompile" your modules to speed up the compilation of your apps (modules with entry-points, the one you actually pass to the GWT compiler) that depend on them. – Thomas Broyer Jul 05 '11 at 13:07
  • i still can't figure out. I created .gwt.xml files for single modules. None of them inherits any other. I still think it is about configurations about maven goals but not sure.. If you have a gwt project, could you please tell me how much time do you spend compiling your modules after a change? Or can you do seperate compiling which i mentioned in my question? – Çağdaş Jul 06 '11 at 07:30
  • Our Jenkins CI server spends approx. 20 minutes to build the whole project (26 Maven modules, 1 GWT module in the webapp project), and then deploys it automatically, each time someone commits in the SVN repo. We developers rarely spend time compiling the whole thing. There's an option in Jenkins to compile only those Maven modules that need it (and their dependents), from the modified paths of the "svn up" command; we haven't turned it on (yet) as there are issues with some Jenkins plugins doing static analysis reporting (PMD/CheckStyle/FindBugs) – Thomas Broyer Jul 06 '11 at 11:07
  • actually i don't know how to react 20 mins build time. But we are doing TDD approach. If i modify a module, i run related tests, which are running in localhost, about it. Before every set up i have to `re:deploy` every module (also fires `gwt:compile` before re-deploy phase) to see changes and it's annoying really. – Çağdaş Jul 06 '11 at 11:25
  • I don't think TDD is about integration tests. I believe you're doing it wrong. TDD is about fast iterations, about unit tests. You don't need to package or deploy to do this. Integration tests are another beast, best done in a CI server. – Thomas Broyer Jul 06 '11 at 14:15
  • i was trying to explain things here, so no need a lesson. Thank you any way.if you don't have an answer about question? – Çağdaş Jul 06 '11 at 14:48
  • Well, it's hard to tell. I seem to understand that gwt-maven-plugin doesn't manage to detect that some modules haven't changed and always compiles them all. I believe gwt-maven-plugin checks the modules' source path, so if they overlap and you changed something in the common source path, gwt-maven-plugin will rebuild them all. Maybe it's your problem? All I can say is that the check works with a single module because I wanted to test whether a -Dgwt.compiler.localWorkers in my MAVEN_OPTS would be taken into account and it refused to re-compile my module. – Thomas Broyer Jul 06 '11 at 15:35
  • You might be running into http://jira.codehaus.org/browse/MGWT-301 The 2.3.0-1 version which fixes it can tested right now, see https://groups.google.com/d/topic/codehaus-mojo-gwt-maven-plugin-users/1dJZJVkukGU/discussion – Thomas Broyer Jul 06 '11 at 22:24
  • thanks for explanation Thomas. It was about source path configuration. And solved it. – Çağdaş Jul 11 '11 at 14:24