We have a Maven project (packaged as JAR) with Java files. A new Java source file was recently added to this project. The path in which the Java f
The Maven Compiler plugin internally assembles a command line call containing the arguments passed to javac, one argument per source file (using the sourcefiles version of the javac call). It does pass the actual source folders also for meta-capabilities like annotation processing, but when individual source files are passed to javac, these take precedence and the compiler has no efficient way to find out which file belongs to which source folder and hence can't validate the package structure.
The Maven Compiler Plugin internally uses the Plexus Compiler API, and you can find the relevant code in these two classes: