|
46 | 46 | </distributionManagement> |
47 | 47 |
|
48 | 48 | <profiles> |
| 49 | + <profile> |
| 50 | + <!-- Error Prone ships Java 21 class files, so javac can only load it on |
| 51 | + a JDK that new. Keep the build working on ${java.version}, which is |
| 52 | + what the artifact targets and what tools such as CodeQL autobuild |
| 53 | + select, and run Error Prone wherever it can run. --> |
| 54 | + <id>errorprone</id> |
| 55 | + <activation> |
| 56 | + <jdk>[21,)</jdk> |
| 57 | + </activation> |
| 58 | + <build> |
| 59 | + <plugins> |
| 60 | + <plugin> |
| 61 | + <groupId>org.apache.maven.plugins</groupId> |
| 62 | + <artifactId>maven-compiler-plugin</artifactId> |
| 63 | + <configuration> |
| 64 | + <fork>true</fork> |
| 65 | + <compilerArgs combine.children="append"> |
| 66 | + <arg>-XDcompilePolicy=simple</arg> |
| 67 | + <arg>-XDaddTypeAnnotationsToSymbol=true</arg> |
| 68 | + <arg>--should-stop=ifError=FLOW</arg> |
| 69 | + <arg>-Xplugin:ErrorProne</arg> |
| 70 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg> |
| 71 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> |
| 72 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> |
| 73 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> |
| 74 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> |
| 75 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> |
| 76 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> |
| 77 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> |
| 78 | + <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> |
| 79 | + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> |
| 80 | + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> |
| 81 | + </compilerArgs> |
| 82 | + <annotationProcessorPaths> |
| 83 | + <path> |
| 84 | + <groupId>com.google.errorprone</groupId> |
| 85 | + <artifactId>error_prone_core</artifactId> |
| 86 | + <version>2.50.0</version> |
| 87 | + </path> |
| 88 | + </annotationProcessorPaths> |
| 89 | + </configuration> |
| 90 | + </plugin> |
| 91 | + </plugins> |
| 92 | + </build> |
| 93 | + </profile> |
49 | 94 | <profile> |
50 | 95 | <id>release</id> |
51 | 96 | <build> |
|
118 | 163 | <release>${java.version}</release> |
119 | 164 | <showDeprecation>true</showDeprecation> |
120 | 165 | <showWarnings>true</showWarnings> |
121 | | - <fork>true</fork> |
122 | 166 | <compilerArgs> |
123 | 167 | <arg>-Xlint:all</arg> |
124 | | - <arg>-XDcompilePolicy=simple</arg> |
125 | | - <arg>-XDaddTypeAnnotationsToSymbol=true</arg> |
126 | | - <arg>--should-stop=ifError=FLOW</arg> |
127 | | - <arg>-Xplugin:ErrorProne</arg> |
128 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg> |
129 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> |
130 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> |
131 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> |
132 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> |
133 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> |
134 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> |
135 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> |
136 | | - <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> |
137 | | - <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> |
138 | | - <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> |
139 | 168 | </compilerArgs> |
140 | | - <annotationProcessorPaths> |
141 | | - <path> |
142 | | - <groupId>com.google.errorprone</groupId> |
143 | | - <artifactId>error_prone_core</artifactId> |
144 | | - <version>2.50.0</version> |
145 | | - </path> |
146 | | - </annotationProcessorPaths> |
147 | 169 | </configuration> |
148 | 170 | </plugin> |
149 | 171 | <plugin> |
|
277 | 299 | <requireMavenVersion> |
278 | 300 | <version>3.0.5</version> |
279 | 301 | </requireMavenVersion> |
280 | | - <!-- Error Prone ships Java 21 class files, so javac cannot |
281 | | - load it on an older JDK. The artifact itself still |
282 | | - targets ${java.version}, via release. --> |
| 302 | + <!-- Checkstyle and Error Prone both ship Java 21 class |
| 303 | + files, so a full build needs a JDK that new. Compiling |
| 304 | + alone still works on ${java.version}, which is what the |
| 305 | + artifact targets, for tools that skip the enforcer. --> |
283 | 306 | <requireJavaVersion> |
284 | 307 | <version>[21,)</version> |
285 | 308 | </requireJavaVersion> |
|
0 commit comments