xref: /aosp_15_r20/external/google-java-format/core/pom.xml (revision 10816b529e1d7005ca788e7b4c5efd1c72957e26)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3  ~ Copyright 2015 Google Inc.
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~     http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License.
16  -->
17
18<project xmlns="http://maven.apache.org/POM/4.0.0"
19         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21  <modelVersion>4.0.0</modelVersion>
22  <parent>
23    <groupId>com.google.googlejavaformat</groupId>
24    <artifactId>google-java-format-parent</artifactId>
25  <version>HEAD-SNAPSHOT</version>
26  </parent>
27
28  <artifactId>google-java-format</artifactId>
29
30  <name>Google Java Format</name>
31
32  <description>
33    A Java source code formatter that follows Google Java Style.
34  </description>
35
36  <dependencies>
37    <!-- Required runtime dependencies -->
38    <dependency>
39      <groupId>com.google.guava</groupId>
40      <artifactId>guava</artifactId>
41    </dependency>
42
43    <!-- Compile-time dependencies -->
44    <dependency>
45      <groupId>org.checkerframework</groupId>
46      <artifactId>checker-qual</artifactId>
47      <optional>true</optional>
48    </dependency>
49    <dependency>
50      <groupId>com.google.errorprone</groupId>
51      <artifactId>error_prone_annotations</artifactId>
52      <optional>true</optional>
53    </dependency>
54    <dependency>
55      <groupId>com.google.auto.value</groupId>
56      <artifactId>auto-value-annotations</artifactId>
57      <optional>true</optional>
58    </dependency>
59    <dependency>
60      <groupId>com.google.auto.service</groupId>
61      <artifactId>auto-service-annotations</artifactId>
62      <optional>true</optional>
63    </dependency>
64
65    <!-- Test dependencies -->
66    <dependency>
67      <groupId>junit</groupId>
68      <artifactId>junit</artifactId>
69    </dependency>
70    <dependency>
71      <groupId>com.google.guava</groupId>
72      <artifactId>guava-testlib</artifactId>
73    </dependency>
74    <dependency>
75      <groupId>com.google.truth</groupId>
76      <artifactId>truth</artifactId>
77    </dependency>
78    <dependency>
79      <groupId>com.google.truth.extensions</groupId>
80      <artifactId>truth-java8-extension</artifactId>
81      <scope>test</scope>
82    </dependency>
83    <dependency>
84      <groupId>com.google.testing.compile</groupId>
85      <artifactId>compile-testing</artifactId>
86      <version>0.19</version>
87      <scope>test</scope>
88    </dependency>
89  </dependencies>
90
91  <build>
92    <plugins>
93      <plugin>
94        <artifactId>maven-javadoc-plugin</artifactId>
95        <configuration>
96          <source>11</source>
97          <encoding>UTF-8</encoding>
98          <docencoding>UTF-8</docencoding>
99          <charset>UTF-8</charset>
100          <links>
101            <link>https://guava.dev/releases/${guava.version}/api/docs/</link>
102            <link>https://docs.oracle.com/en/java/javase/11/docs/api</link>
103          </links>
104          <additionalJOptions>
105            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
106            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
107            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
108            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
109            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
110            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
111          </additionalJOptions>
112        </configuration>
113        <executions>
114          <execution>
115            <id>attach-docs</id>
116            <phase>post-integration-test</phase>
117            <goals>
118              <goal>jar</goal>
119            </goals>
120          </execution>
121        </executions>
122      </plugin>
123      <plugin>
124        <groupId>org.apache.maven.plugins</groupId>
125        <artifactId>maven-shade-plugin</artifactId>
126        <version>3.2.4</version>
127        <executions>
128          <execution>
129            <id>shade-all-deps</id>
130            <phase>package</phase>
131            <goals>
132              <goal>shade</goal>
133            </goals>
134            <configuration>
135              <shadedArtifactAttached>true</shadedArtifactAttached>
136              <shadedClassifierName>all-deps</shadedClassifierName>
137              <createDependencyReducedPom>false</createDependencyReducedPom>
138              <!-- http://stackoverflow.com/a/6743609 -->
139              <filters>
140                <filter>
141                  <artifact>*:*</artifact>
142                  <excludes>
143                    <exclude>META-INF/*.SF</exclude>
144                    <exclude>META-INF/*.DSA</exclude>
145                    <exclude>META-INF/*.RSA</exclude>
146                  </excludes>
147                </filter>
148              </filters>
149            </configuration>
150          </execution>
151        </executions>
152      </plugin>
153      <plugin>
154        <groupId>org.apache.maven.plugins</groupId>
155        <artifactId>maven-jar-plugin</artifactId>
156        <configuration>
157          <archive>
158            <manifest>
159              <mainClass>com.google.googlejavaformat.java.Main</mainClass>
160              <addDefaultImplementationEntries>
161                true
162              </addDefaultImplementationEntries>
163            </manifest>
164            <manifestEntries>
165              <Automatic-Module-Name>
166                com.google.googlejavaformat
167              </Automatic-Module-Name>
168            </manifestEntries>
169          </archive>
170        </configuration>
171      </plugin>
172      <plugin>
173        <groupId>com.google.code.maven-replacer-plugin</groupId>
174        <artifactId>replacer</artifactId>
175        <version>1.5.3</version>
176        <executions>
177          <execution>
178            <phase>generate-sources</phase>
179            <goals>
180              <goal>replace</goal>
181            </goals>
182          </execution>
183        </executions>
184        <configuration>
185          <file>${project.basedir}/src/main/java/com/google/googlejavaformat/java/GoogleJavaFormatVersion.java.template</file>
186          <outputFile>${project.build.directory}/generated-sources/java/com/google/googlejavaformat/java/GoogleJavaFormatVersion.java</outputFile>
187          <replacements>
188            <replacement>
189              <token>%VERSION%</token>
190              <value>${project.version}</value>
191            </replacement>
192          </replacements>
193        </configuration>
194      </plugin>
195      <plugin>
196        <groupId>org.codehaus.mojo</groupId>
197        <artifactId>build-helper-maven-plugin</artifactId>
198        <version>3.3.0</version>
199        <executions>
200          <execution>
201            <id>add-source</id>
202            <phase>generate-sources</phase>
203            <goals>
204              <goal>add-source</goal>
205            </goals>
206            <configuration>
207              <sources>
208                <source>${project.build.directory}/generated-sources/java/</source>
209              </sources>
210            </configuration>
211          </execution>
212        </executions>
213      </plugin>
214      <plugin>
215        <groupId>org.apache.maven.plugins</groupId>
216        <artifactId>maven-compiler-plugin</artifactId>
217        <configuration>
218          <source>11</source>
219          <target>11</target>
220        </configuration>
221      </plugin>
222    </plugins>
223  </build>
224
225  <profiles>
226    <profile>
227      <id>jdk11</id>
228      <activation>
229        <jdk>[11,17)</jdk>
230      </activation>
231      <build>
232        <plugins>
233          <plugin>
234            <groupId>org.apache.maven.plugins</groupId>
235            <artifactId>maven-compiler-plugin</artifactId>
236            <configuration>
237              <excludes>
238                <exclude>**/Java17InputAstVisitor.java</exclude>
239                <exclude>**/Java21InputAstVisitor.java</exclude>
240              </excludes>
241            </configuration>
242          </plugin>
243          <plugin>
244            <artifactId>maven-javadoc-plugin</artifactId>
245            <configuration>
246              <excludePackageNames>com.google.googlejavaformat.java.java17</excludePackageNames>
247              <excludePackageNames>com.google.googlejavaformat.java.java21</excludePackageNames>
248            </configuration>
249          </plugin>
250        </plugins>
251      </build>
252    </profile>
253    <profile>
254      <id>jdk17</id>
255      <activation>
256        <jdk>[17,21)</jdk>
257      </activation>
258      <build>
259        <plugins>
260          <plugin>
261            <groupId>org.apache.maven.plugins</groupId>
262            <artifactId>maven-compiler-plugin</artifactId>
263            <configuration>
264              <excludes>
265                <exclude>**/Java21InputAstVisitor.java</exclude>
266              </excludes>
267            </configuration>
268          </plugin>
269          <plugin>
270            <artifactId>maven-javadoc-plugin</artifactId>
271            <configuration>
272              <excludePackageNames>com.google.googlejavaformat.java.java21</excludePackageNames>
273            </configuration>
274          </plugin>
275        </plugins>
276      </build>
277    </profile>
278    <profile>
279      <id>native</id>
280      <build>
281        <plugins>
282          <plugin>
283            <groupId>org.graalvm.buildtools</groupId>
284            <artifactId>native-maven-plugin</artifactId>
285            <version>0.9.13</version>
286            <extensions>true</extensions>
287            <executions>
288              <execution>
289                <id>build-native</id>
290                <goals>
291                  <goal>build</goal>
292                </goals>
293                <phase>package</phase>
294              </execution>
295              <execution>
296                <id>test-native</id>
297                <goals>
298                  <goal>test</goal>
299                </goals>
300                <phase>test</phase>
301              </execution>
302            </executions>
303            <configuration>
304              <imageName>google-java-format</imageName>
305              <classpath>
306                <param>${project.build.directory}/${project.artifactId}-${project.version}-all-deps.jar</param>
307              </classpath>
308              <buildArgs>
309                <buildArg>-H:IncludeResourceBundles=com.sun.tools.javac.resources.compiler</buildArg>
310                <buildArg>--no-fallback</buildArg>
311                <buildArg>--initialize-at-build-time=com.sun.tools.javac.file.Locations</buildArg>
312              </buildArgs>
313            </configuration>
314          </plugin>
315        </plugins>
316      </build>
317    </profile>
318  </profiles>
319</project>
320