I have a project setup with Maven and using RequestFactory. However I cannot get the validation to work through maven settings. This is how my maven setup looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<proc>none</proc>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
I have also added Hibernate validator.
On the Eclipse side, I have tried various things, among which the most correct one looks like this:
I also have installed the m2e-apt plugin.
However I still can't get the validation tool to run. I don't get validation errors if I make mistakes on purpose and of course, when I run my application I get the infamous
SEVERE: Unexpected error java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the ...
Anyone has any idea of what I am missing? Should I simply resign myself to configure Eclipse manually?
You explicitly disabled annotation processing in the maven-compiler-plugin
's configuration:
<proc>none</proc>
Remove that line and it should run annotation processors.
Note that there's a regression with maven-compiler-plugin
3.x where the plugin dependencies no longer are taken into account when compiling (it probably never was thought as a feature) so your requestfactory-apt
would not be seen by JavaC with recent maven-compiler-plugin
versions and you'd still have the same problem then.
The only way to reliably use annotation processors with Maven is to declare them as project dependencies with either <scope>provided</scope>
or <optional>true</optional>
, or to use the maven-processor-plugin
. There's an open feature request for better support in Maven proper through the maven-compiler-plugin
: http://jira.codehaus.org/browse/MCOMPILER-203