Does the maven-compiler-plugin plugin consider dependencies when checking outdated sources?

The Ant depend task allows you to recompile the Java source code if any of its dependencies (class references, not module dependencies) have been changed. I quickly looked through org.apache.maven.plugin.CompilerMojo and org.codehaus.plexus.compiler.util.scan.StaleSourceScanner and, in appearance, they do not take into account dependencies at all. It looks like the source code is recompiled if its timestamp is newer than the class source file (plus some delta).

Did I miss something or did Maven ignore the case where the source code has not changed, but its dependency (hence, they both have to be recompiled)?

+6
source share
2 answers

You have not missed anything. Maven ignores this case. You will need to get around it with a clean build.

maven-versions-plugin can check if new versions are available, so half the equation. Net remodeling is still manual work.

0
source

I am using maven-antrun-plugin. There you can configure it. I do not think it is automatic. What I mean should be specified manually the first time it is compiled manually. After the maven wards deal with your problem.

0
source

Source: https://habr.com/ru/post/900378/


All Articles