Elemento, maven config to force template implementation class regen

103 views
Skip to first unread message

Rob Newton

unread,
Mar 26, 2018, 4:19:26 AM3/26/18
to GWT Users
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 ?

Thanks,
Rob

Ahmad Bawaneh

unread,
Mar 26, 2018, 5:25:18 AM3/26/18
to GWT Users
try mvn process-sources

Rob Newton

unread,
Mar 26, 2018, 8:28:56 PM3/26/18
to GWT Users
Trying mvn process-sources or mvn generate-sources does not help. 

Thomas Broyer

unread,
Mar 27, 2018, 5:36:22 AM3/27/18
to GWT Users


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.

Rob Newton

unread,
Mar 28, 2018, 7:54:45 PM3/28/18
to GWT Users
Thankyou Thomas, that is good to know.
Reply all
Reply to author
Forward
0 new messages