google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.86k stars 744 forks source link

Suggest update Maven installation to use profiles #2775

Open Capstan opened 2 years ago

Capstan commented 2 years ago

When trying to apply the installation instructions to a multi-JDK build project, I ran into cases where the specific JDK logic could not be used uniformly. I ended up just dropping it out of JDK 8, but kept it for JDK 9 and JDK 17 using the instructions for JDK 16, but I had to wrap it all in Maven profiles, a la

  <profiles>
    <profile>
      <id>java9</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <build>
        …
      </build>
    </profile>
  </profiles>

Perhaps consider replacing the per-JDK instructions with a single <profiles>-based approach, with specific XML comments to indicate what consumers could pull out if they don't care about multi-JDK support. This would have the benefit that if they do float from an older version to a newer version, at least ErrorProne won't break on them.

Capstan commented 2 years ago

The specific case I'm mentioning is https://github.com/googleapis/java-datastore/pull/592.