Maven + Java package declaration

前端 未结 1 601
春和景丽
春和景丽 2021-01-04 12:18

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

1条回答
  •  清酒与你
    2021-01-04 12:29

    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:

    • plexus-compiler-api: AbstractCompiler
    • plexus-compiler-javac: JavacCompiler

    0 讨论(0)
提交回复
热议问题