jflex
jflex copied to clipboard
jflex-maven-plugin - Regeneration of previously generated classes changes modification date of the output file
When I mvn package already packaged module I got a log informing MyJflexFile.java is up to date, but I noticed its modification date has changed. This triggers Maven compiler plugin to recompile the module. I suggest to not change the modification date if content does not change.
There is a PR to work around this bug in Maven #765
Alternatively, use Bazel.
I'll leave this open -- #765 does not fix it, it just provides specific dates for the jar file.
So I tried this and couldn't reproduce it. When I do mvn generate-sources or mvn package and get an "up to date" output from the plugin, the file modification time of the generated target sources does not change and sources are also not recompiled ("Nothing to compile - all classes are up to date" from the maven-compiler-plugin) for me.
mvn package does re-run the test suite and re-package the compiled classes, but it does not recompile for me.
Looking at the code, it does explicitly check for modification time in the plugin (that's when it generates the "up to date" output) and returns without further action from that path.
It's possible that this was indeed a more general maven bug that has been fixed since.
I'll close this one for now, but if you keep seeing this behaviour, please do feel free to re-open.