Tuesday, March 27, 2018

Re: Elemento, maven config to force template implementation class regen



On Monday, March 26, 2018 at 10:19:26 AM UTC+2, Rob Newton wrote:
Hi,

When I edit an Elemento template HTML file and do a mvn compile it won't regenerate the template implementation class source file.   Is there some maven pom config and/or command I can use to say rerun the elemento annotation processor without doing a mvn clean or touching the template abstract class source file ?

I don't use Elemento, but AFAIU the problem lies in how annotation processors work and how Elemento uses them, and how the maven-compiler-plugin works (it would be the same with other build tools though).
Build tools don't expect that the result of compilation changes based on a resource file (because resources are meant to be bundled with the compiled classes, with side-effects at runtime rather than compile-time), and annotation processors can indicate which Java element triggered the generation of some file, and only Java elements, not resources. Consequently, the maven-compiler-plugin (rightfully) thinks it has nothing to do if Java source files haven't changed.

Annotation processors are not a good fit for this kind of work; non-Java templates should be processed by generators to generate Java source that will then be fed to the Java compiler (and possibly trigger annotation processing).

In the mean time, you'll have to "touch" the class responsible for the processing of the template to trigger a recompile.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment