-
Notifications
You must be signed in to change notification settings - Fork 0
Changes in compiler parameters
In its current version, the new plugin does not remove any parameters that exist in version 3 of maven-compiler-plugin
.
However, the behavior of some parameters has been modified and some parameters are deprecated.
This page lists the changes.
The following parameters are deprecated but are still working:
-
<compileSourceRoots>
: replaced by the project-wide<sources>
element. -
<compilerArgument>
: already replaced by<compilerArgs>
since Maven 3.1. The replacement uses a list of strings instead of a single string. -
<testCompilerArgument>
: replaced by<testCompilerArgs>
for the same reason as above. Note that the latter is a new parameter introduced in Maven 4, see next point. -
<testCompilerArguments>
: replaced by<testCompilerArgs>
for consistency with the main plugin. The former parameter was inconsistent in the name ("Arguments" suffix instead of "Args"), but also in the value type (Map<String,String>
instead ofList<String>
). -
<annotationProcessorPaths>
: replaced by ordinary dependencies with<type>proc</type>
. The latter is a new artifact type introduced in Maven 4-alpha13. -
<useModulePath>
: replaced by<type>classpath-jar</type>
declarations in dependencies.
The following parameters are marked as deprecated for removal. They all became no-op in the new plugin:
-
<forceJavacCompilerUse>
: the documentation is not really explicit, but this parameters seems to be about forcing the use ofjava.lang.Compiler
API instead ofjavax.tools.JavaCompiler
. The former class was deprecated since Java 9 and no longer exists in Java 21. -
<compilerVersion>
: this parameter was passed toorg.codehaus.plexus.compiler.CompilerConfiguration
, but it is unclear how the Plexus compiler used it. We see no obvious mapping injavax.tools
orjava.lang.Process
API. -
<compilerReuseStrategy>
: does not apply well to thejavax.tools.JavaCompiler
API that the new plugin is using. -
<skipMultiThreadWarning>
: deprecated as a consequence of<compilerReuseStrategy>
deprecation. -
<optimize>
: was already deprecated in Maven 3, reported here for completness. -
<outputFileName>
: producing the final JAR file can be considered as the task of separated plugins, for example the JAR plugin. Furthermore, this parameter does not work well in the context of Module Source Hierarchy, because the output is not a single JAR file. -
<outputTimestamp>
: not really applicable to the Maven compiler plugin. It was used only as an heuristic rules for guessing if the developer intended to have a reproducible build.
The Maven compiler plugin has numerous default values, which sometime differ from the standard (JDK) default values.
For example, the default value of -source
and -target
options was hard-coded to "1.8" in Maven 3,
while the standard (JDK) default is the version of the JDK used for compiling the code.
The following parameters had their default value modified in the new plugin:
-
<source>
and<target>
: removed the default value and added a Javadoc saying "As of Java 9, the --release option is preferred." -
<release>
: no default value. Therefor, the standard (JDK) default applies.- If both
<release>
and<target>
are unspecified, a warning is logged.
- If both
-
<debugLevel>
: omitting this parameter now means "JDK default debug info" instead of "all debug info".- A new
all
level (Maven-specific) has been added for meaning "all debug info".
- A new
-
<createMissingPackageInfoClass>
: default changed fromtrue
tofalse
, because this workaround is no longer necessary for the new incremental build system. -
<showWarnings>
: default totrue
for consistency with the JDK default value.
The following changes are in consideration, but not yet applied.
The intend for those changes would be to have the same default values as the javac
tool:
-
<meminitial>
and<maxmem>
: if no unit is specified, change the default from 'M' to bytes as interpreted by thejavac
tool.
- Include/exclude filters accept also glob and regex syntax (see implementation changes).
- All parameters for memory settings accept also 'K' and 'G' suffix in addition of 'M'.
-
<debugLevel>
values unknown to the plugin but known by the compiler are now accepted.