How to disable Log4j2 annotation / plugin processor during (Maven) compilation?

Viewed 483

Log4j 2 uses activates an annotation processor by default (so it can catch classes that are annotated with @Plugin) as described here:

https://logging.apache.org/log4j/2.x/manual/plugins.html

My question is: what is the recommended way of disabling this annotation processor - it takes an enormous amount of resources during Maven compile.

Simply removing the the following process-plugins execution from the maven-compiler-plugin declared in log4j-core's pom.xml didn't seem to do the trick:

  <execution>
    <!-- then do a processing-only pass to generate plugins .dat file -->
    <id>process-plugins</id>
    <goals>
      <goal>compile</goal>
    </goals>
    <phase>process-classes</phase>
    <configuration>
      <excludes>
        <exclude>module-info.java</exclude>
      </excludes>
      <proc>only</proc>
    </configuration>
  </execution>

The only way that i know is adding -proc:none to the compiler arguments, but what if i have other annotation processors that will be needed in the future? -proc:none seems like a too "binary" solution. It would be nice to disable it just for the specific dependency of Log4j2.

Best regards, Teo

0 Answers
Related