maven-compiler-plugin icon indicating copy to clipboard operation
maven-compiler-plugin copied to clipboard

Provide easy way to convert all warnings into errors except specific

Open tatsiana-skurydzina-rovio opened this issue 7 months ago • 1 comments

Easy way to treat warnings as errors except specific type/s

Hi

I'm playing with the latest documentation and source code for maven-compiler-plugin for a couple of hours but I cannot find the proper way to achieve what I want. It means I either missing something in the doc or it's missing.

My goal to achieve the following behaviour with maven-compiler-plugin: fail build on warnings, treat them as errors except usage of deprecated annotation.

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
          <configuration>
              <source>17</source>
              <release>17</release>
              <parameters>true</parameters>
              <compilerArgs>
                  <arg>-Xlint:all</arg>
                  <arg>-Xlint:-deprecation</arg>
                  <arg>-Werror</arg>
              </compilerArgs>
          <configuration>
 </plugin>

It seems the most straightforward but it doesn't compile and other combinations with showDeprecation.

Did I miss something obvious or there is no way to archive such behaviour?

I just tried a small test case with above configuration and couldn't reproduce the problem with compiler plugin 3.14.0. Could you post a more complete test case?

desruisseaux avatar Jun 22 '25 11:06 desruisseaux