Do you like GWT the way I love it? Recently, there was a task to hang Sonar on a project that uses GWT. The problem arose at the moment when Clover is cut. Details of this story under the cut.
So what is the salt. Clover copies the sorts to the target folder, complements them with its code and analyzes, after which the gwt-maven-plugin comes in, which the whole thing happily tries to compile and we get an error of the form:
No source code is available for type ....; did you forget to inherit a required module?
And as a class not found is one of Clover classes. And this means that we have not announced the clover import in the * .gwt.xml module. However unpleasant. The solution was found relatively quickly.
In the properties block, we declare a variable:
<properties> ... <gwt.module>MyModule.gwt.xml</gwt.module> ... </properties>
')
We tyun our gwt-maven-plugin (I use 2.2.0):
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.2.0</version> <executions> <execution> <configuration> <module>${gwt.module}</module> </configuration> <goals> <goal>compile</goal> </goals> </execution> </executions> </plugin>
Now in the test resources we create another module and call it Empty.gwt.xml:
<module rename-to="empty"> </module>
Now we create a profile for Sonar, in which we redefine the value of the module:
<profiles> <profile> <id>Sonar</id> <properties> <gwt.module>Empty.gwt.xml</gwt.module> </properties> </profile> </profiles>
Done, now this module needs to be turned on when running under Sonar, this is done so
-P Sonar .