This repository is created to reproduce a specific build error encountered in IntelliJ IDEA when working with a multi-module Maven project.
When configuring -Xlint options from a parent Maven project in a multi-module setup, Maven itself builds the project correctly and honors the suppression of certain warnings as configured.
However, IntelliJ IDEA does not behave as expected in this scenario:
- IntelliJ provoke build errors on all warnings, including those that are explicitly suppressed via the
-Xlintoptions. - IntelliJ fails to suppress warnings like
-deprecationand-processingwhich are configured to be ignored. - This discrepancy causes confusion and false-positive error reporting inside the IDE, although Maven builds succeed.
The problematic configuration is typically defined in the parent pom.xml like this:
<properties>
<!-- treat warnings as errors as default -->
<fail.on.warnings.args>-Werror</fail.on.warnings.args>
<!-- deprecations and annotation processing are suppressed -->
<xlint.args>-Xlint:all,-deprecation,-processing</xlint.args>
<!-- specify the encoding once per entire project -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<showWarnings>true</showWarnings>
<compilerArgs>
<args>${fail.on.warnings.args}</args>
<args>${xlint.args}</args>
</compilerArgs>
</configuration>
</plugin>This class used a deprecated feature. This warning provokes build error in IDEA.
public class Module1 implements Supplier<String> {
protected static final String MODULE_NAME = "module1";
@Override
public String get() {
return MODULE_NAME;
}
/**
* Build in intellij IDEA will fail on this warning.
* However, this is a warning that should be suppressed given the options set in the ReactorCore module.
*/
public void triggerCompileError() {
new Date(0, Calendar.NOVEMBER, 10);
}
}