• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>1.9</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
55
56    <!-- Test dependencies -->
57    <dependency>
58      <groupId>junit</groupId>
59      <artifactId>junit</artifactId>
60    </dependency>
61    <dependency>
62      <groupId>com.google.guava</groupId>
63      <artifactId>guava-testlib</artifactId>
64    </dependency>
65    <dependency>
66      <groupId>com.google.truth</groupId>
67      <artifactId>truth</artifactId>
68    </dependency>
69    <dependency>
70      <groupId>com.google.testing.compile</groupId>
71      <artifactId>compile-testing</artifactId>
72      <version>0.15</version>
73      <scope>test</scope>
74    </dependency>
75  </dependencies>
76
77  <build>
78    <plugins>
79      <plugin>
80        <artifactId>maven-javadoc-plugin</artifactId>
81        <configuration>
82          <source>11</source>
83          <encoding>UTF-8</encoding>
84          <docencoding>UTF-8</docencoding>
85          <charset>UTF-8</charset>
86          <links>
87            <link>https://guava.dev/releases/${guava.version}/api/docs/</link>
88            <link>https://docs.oracle.com/en/java/javase/11/docs/api</link>
89          </links>
90          <additionalJOptions>
91            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
92            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
93            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
94            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
95            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
96            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
97            <additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,com.google.googlejavaformat</additionalJOption>
98          </additionalJOptions>
99        </configuration>
100        <executions>
101          <execution>
102            <id>attach-docs</id>
103            <phase>post-integration-test</phase>
104            <goals>
105              <goal>jar</goal>
106            </goals>
107          </execution>
108        </executions>
109      </plugin>
110      <plugin>
111        <groupId>org.apache.maven.plugins</groupId>
112        <artifactId>maven-shade-plugin</artifactId>
113        <version>2.4.3</version>
114        <executions>
115          <execution>
116            <id>shade-all-deps</id>
117            <phase>package</phase>
118            <goals>
119              <goal>shade</goal>
120            </goals>
121            <configuration>
122              <shadedArtifactAttached>true</shadedArtifactAttached>
123              <shadedClassifierName>all-deps</shadedClassifierName>
124              <createDependencyReducedPom>false</createDependencyReducedPom>
125              <!-- http://stackoverflow.com/a/6743609 -->
126              <filters>
127                <filter>
128                  <artifact>*:*</artifact>
129                  <excludes>
130                    <exclude>META-INF/*.SF</exclude>
131                    <exclude>META-INF/*.DSA</exclude>
132                    <exclude>META-INF/*.RSA</exclude>
133                  </excludes>
134                </filter>
135              </filters>
136            </configuration>
137          </execution>
138        </executions>
139      </plugin>
140      <plugin>
141        <groupId>org.apache.maven.plugins</groupId>
142        <artifactId>maven-jar-plugin</artifactId>
143        <configuration>
144          <archive>
145            <manifest>
146              <mainClass>com.google.googlejavaformat.java.Main</mainClass>
147              <addDefaultImplementationEntries>
148                true
149              </addDefaultImplementationEntries>
150            </manifest>
151            <manifestEntries>
152              <Automatic-Module-Name>
153                com.google.googlejavaformat
154              </Automatic-Module-Name>
155            </manifestEntries>
156          </archive>
157        </configuration>
158      </plugin>
159      <plugin>
160        <artifactId>maven-resources-plugin</artifactId>
161        <version>3.0.1</version>
162        <executions>
163          <execution>
164            <id>copy-resources</id>
165            <phase>package</phase>
166            <goals>
167              <goal>copy-resources</goal>
168            </goals>
169            <configuration>
170              <outputDirectory>../eclipse_plugin/lib</outputDirectory>
171              <resources>
172                <resource>
173                  <directory>target</directory>
174                  <include>${project.artifactId}-${project.version}.jar</include>
175                </resource>
176              </resources>
177            </configuration>
178          </execution>
179        </executions>
180      </plugin>
181      <plugin>
182        <groupId>org.apache.maven.plugins</groupId>
183        <artifactId>maven-dependency-plugin</artifactId>
184        <version>2.10</version>
185        <executions>
186          <execution>
187            <id>copy-dependencies</id>
188            <phase>package</phase>
189            <goals>
190              <goal>copy-dependencies</goal>
191            </goals>
192            <configuration>
193              <outputDirectory>../eclipse_plugin/lib</outputDirectory>
194              <overWriteReleases>true</overWriteReleases>
195              <overWriteSnapshots>true</overWriteSnapshots>
196              <excludeTransitive>true</excludeTransitive>
197              <excludeArtifactIds>org.eclipse.jdt.core</excludeArtifactIds>
198              <excludeScope>compile</excludeScope>
199              <excludeScope>provided</excludeScope>
200            </configuration>
201          </execution>
202        </executions>
203      </plugin>
204      <plugin>
205        <groupId>com.google.code.maven-replacer-plugin</groupId>
206        <artifactId>replacer</artifactId>
207        <version>1.5.3</version>
208        <executions>
209          <execution>
210            <phase>generate-sources</phase>
211            <goals>
212              <goal>replace</goal>
213            </goals>
214          </execution>
215        </executions>
216        <configuration>
217          <file>${project.basedir}/src/main/java/com/google/googlejavaformat/java/GoogleJavaFormatVersion.java.template</file>
218          <outputFile>${project.build.directory}/generated-sources/java/com/google/googlejavaformat/java/GoogleJavaFormatVersion.java</outputFile>
219          <replacements>
220            <replacement>
221              <token>%VERSION%</token>
222              <value>${project.version}</value>
223            </replacement>
224          </replacements>
225        </configuration>
226      </plugin>
227      <plugin>
228        <groupId>org.codehaus.mojo</groupId>
229        <artifactId>build-helper-maven-plugin</artifactId>
230        <version>3.0.0</version>
231        <executions>
232          <execution>
233            <id>add-source</id>
234            <phase>generate-sources</phase>
235            <goals>
236              <goal>add-source</goal>
237            </goals>
238            <configuration>
239              <sources>
240                <source>${project.build.directory}/generated-sources/java/</source>
241              </sources>
242            </configuration>
243          </execution>
244        </executions>
245      </plugin>
246      <plugin>
247        <groupId>org.apache.maven.plugins</groupId>
248        <artifactId>maven-compiler-plugin</artifactId>
249        <configuration>
250          <source>11</source>
251          <target>11</target>
252        </configuration>
253      </plugin>
254    </plugins>
255  </build>
256
257  <profiles>
258    <profile>
259      <id>jdk11</id>
260      <activation>
261        <jdk>(,14)</jdk>
262      </activation>
263      <build>
264        <plugins>
265          <plugin>
266            <groupId>org.apache.maven.plugins</groupId>
267            <artifactId>maven-compiler-plugin</artifactId>
268            <configuration>
269              <excludes>
270                <exclude>**/Java14InputAstVisitor.java</exclude>
271              </excludes>
272            </configuration>
273          </plugin>
274          <plugin>
275            <artifactId>maven-javadoc-plugin</artifactId>
276            <configuration>
277              <excludePackageNames>com.google.googlejavaformat.java.java14</excludePackageNames>
278            </configuration>
279          </plugin>
280        </plugins>
281      </build>
282    </profile>
283  </profiles>
284</project>
285