Re: Maven recompiles every time, even when code has not been changed


danielb987
 

Yes. See PR #8820 that fixes this package-file.

https://github.com/JMRI/JMRI/pull/8820

It's ready to be merged once CI passes.

Daniel

2020-07-10 21:08 skrev Bob Jacobsen:

Nice.
Lots of package-info.java files end with something like:
* @see jmri.managers
* @see jmri.implementation
*/
// include empty DefaultAnnotation to avoid excessive recompilation
@edu.umd.cs.findbugs.annotations.DefaultAnnotation(value={})
package jmri;
But java/src/apps/jmrit/package-info.java doesn’t. Does adding that
fix this case?
Bob

On Jul 10, 2020, at 12:05 PM, danielb987 <db123@...> wrote:
I think I have a simple solution to both the problem of finding the problematic java file and the problem about checking it in CI:
If I do a:
mvn clean compile
and then a:
mvn -X compile | grep "Stale source detected"
I get the line:
[DEBUG] Stale source detected: /home/daniel/Dokument/GitHub/JMRI/java/src/apps/jmrit/package-info.java
So if we add a test to CI that does:
mvn clean compile
mvn -X compile | grep "Stale source detected" > check_stale_source.txt
we should have the file "check_stale_source.txt" empty. If it isn't, we can print it and let CI to fail.
Daniel
2020-07-10 20:12 skrev Randall Wood via groups.io:
.class files are the result of compiling the project and are not
checked into code. It is not a compilation error that a .java file
does not result in a .class file (nor is it a compilation error that a
.java file compiles multiple .class files). It does however, make it
really difficult for a build tool to determine that sources are
compiled and current (especially since we also derive .java sources to
compile from other non-.java sources).
How it gets fixed depends entirely on what the source is supposed to be.
Randall
On Jul 10, 2020, at 13:44, danielb987 <db123@...> wrote:
I have this problem with JMRI master.
Is there a way to see which java files that don't have any class file? And how do I fix it?
It would be great if a check that ensures that every java file has a class file is added to CI so that a developer would be notified about it before a PR is merged into master.
Daniel
2020-07-10 19:27 skrev Randall Wood via groups.io:
Some .java source has no corresponding .class file after compilation.
Randall
On Jul 10, 2020, at 13:18, danielb987 <db123@...> wrote:
I have the problem that every time I run maven, it tells "Changes detected - recompiling the module!" and recompiles everything, even if no changes are done to the code.
If I run:
mvn test -Dtest=jmri.jmrit.beantable.LogixTableActionTest
and when it's done, run the same command again without changing anything:
mvn test -Dtest=jmri.jmrit.beantable.LogixTableActionTest
it still say "Changes detected - recompiling the module!". This happens both when I run maven from NetBeans and when I run maven from the command line.
I have tried "ant realclean" but it makes no difference.
Any idea of what is wrong?
Daniel

Bob Jacobsen
@BobJacobsen

Join jmri@jmri-developers.groups.io to automatically receive all group messages.