2

I have a pure-Java project (A) and a GWT project (B) set up as a multi-module GWT project as described here.

When I run mvn install for the first time, A compiles, then B performs a full GWT compile. However if I change anything in A, then B does not compile as I would expect; I get

[INFO] <module> is up to date. GWT compilation skipped.

If I enable <force>true</force then it does compile and I can see my changes.

How can I make my project automatically compile when a dependent module has changed, and skip compilation if nothing has changed?

funkybro
  • 8,432
  • 6
  • 39
  • 52

1 Answers1

1

I wouldn't be surprised if incremental builds are broken in the gwt-maven-plugin, just like in almost every Maven plugin out there: https://cwiki.apache.org/confluence/display/MAVEN/Incremental+Builds

There's a note about it in the sources: https://github.com/gwt-maven-plugin/gwt-maven-plugin/blob/d6464421d9ceb815db2d594ae0bf2d9ca07a1643/src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java#L390

I tend to agree that, the maven-compiler-plugin being broken in a similar way, you should do a clean anyway in this situation. Alternatively, if you know the change is compatible with your code and shouldn't change the output of the maven-compiler-plugin, then force the GWT compilation by passing -Dgwt.compiler.force on the command line.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • Hmm. I was looking for a way to make the compilation just happen when the core project A had been changed, and not if not. I compile my GWT project "in the background" as part of an xcode build, and would like everything to be compiled only when needed. I guess my use case is not the same as most. – funkybro Jul 30 '13 at 11:45
  • I think we all want a working incremental build, it just isn't there yet in Maven (assuming it can be fixed, which I'm doubtful about) – Thomas Broyer Jul 30 '13 at 15:37
  • @funkybro Depends how you code your build file: there's no (official) GWT Compiler task so you use a `` task to run the compiler which won't do any staleness check; you have to do the check _by hand_ using an `` task or similar. – Thomas Broyer Jul 31 '13 at 10:23