Skip to content

Commit 523c906

Browse files
deps: update dependency com.google.googlejavaformat:google-java-format to v1.26.0 (GoogleCloudPlatform#3114)
* deps: update dependency com.google.googlejavaformat:google-java-format to v1.26.0 * build: only run formatter for JDK17 and higher --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com>
1 parent 6ab2773 commit 523c906

3 files changed

Lines changed: 42 additions & 30 deletions

File tree

samples/snippets/java-snippets/pom.xml

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,41 @@
5454
<scope>test</scope>
5555
</dependency>
5656
</dependencies>
57+
<profiles>
58+
<profile>
59+
<id>format</id>
60+
<activation>
61+
<jdk>[17,)</jdk>
62+
</activation>
63+
<build>
64+
<plugins>
65+
<plugin>
66+
<groupId>com.spotify.fmt</groupId>
67+
<artifactId>fmt-maven-plugin</artifactId>
68+
<version>2.25</version>
69+
<executions>
70+
<execution>
71+
<goals>
72+
<goal>format</goal>
73+
</goals>
74+
</execution>
75+
</executions>
76+
<configuration>
77+
<style>google</style>
78+
<verbose>true</verbose>
79+
</configuration>
80+
<dependencies>
81+
<dependency>
82+
<groupId>com.google.googlejavaformat</groupId>
83+
<artifactId>google-java-format</artifactId>
84+
<version>1.26.0</version>
85+
</dependency>
86+
</dependencies>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</profile>
91+
</profiles>
5792
<build>
5893
<plugins>
5994
<plugin>
@@ -120,29 +155,6 @@
120155
<cleanupDaemonThreads>false</cleanupDaemonThreads>
121156
</configuration>
122157
</plugin>
123-
<plugin>
124-
<groupId>com.coveo</groupId>
125-
<artifactId>fmt-maven-plugin</artifactId>
126-
<version>2.9</version>
127-
<executions>
128-
<execution>
129-
<goals>
130-
<goal>format</goal>
131-
</goals>
132-
</execution>
133-
</executions>
134-
<configuration>
135-
<style>google</style>
136-
<verbose>true</verbose>
137-
</configuration>
138-
<dependencies>
139-
<dependency>
140-
<groupId>com.google.googlejavaformat</groupId>
141-
<artifactId>google-java-format</artifactId>
142-
<version>1.7</version>
143-
</dependency>
144-
</dependencies>
145-
</plugin>
146158
</plugins>
147159
</build>
148160
</project>

samples/snippets/java-snippets/src/main/java/com/google/example/WriteDataWithDml.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ static void writeDataWithDml(String host, int port, String database) throws SQLE
5050

5151
final List<Singer> singers =
5252
Arrays.asList(
53-
new Singer(/* SingerId = */ 12L, "Melissa", "Garcia"),
54-
new Singer(/* SingerId = */ 13L, "Russel", "Morales"),
55-
new Singer(/* SingerId = */ 14L, "Jacqueline", "Long"),
56-
new Singer(/* SingerId = */ 15L, "Dylan", "Shaw"));
53+
new Singer(/* SingerId= */ 12L, "Melissa", "Garcia"),
54+
new Singer(/* SingerId= */ 13L, "Russel", "Morales"),
55+
new Singer(/* SingerId= */ 14L, "Jacqueline", "Long"),
56+
new Singer(/* SingerId= */ 15L, "Dylan", "Shaw"));
5757

5858
// Note that JDBC parameters start at index 1.
5959
int paramIndex = 0;

samples/snippets/java-snippets/src/main/java/com/google/example/WriteDataWithDmlBatch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ static void writeDataWithDmlBatch(String host, int port, String database) throws
4545
"INSERT INTO singers (singer_id, first_name, last_name) VALUES (?, ?, ?)")) {
4646
final List<Singer> singers =
4747
Arrays.asList(
48-
new Singer(/* SingerId = */ 16L, "Sarah", "Wilson"),
49-
new Singer(/* SingerId = */ 17L, "Ethan", "Miller"),
50-
new Singer(/* SingerId = */ 18L, "Maya", "Patel"));
48+
new Singer(/* SingerId= */ 16L, "Sarah", "Wilson"),
49+
new Singer(/* SingerId= */ 17L, "Ethan", "Miller"),
50+
new Singer(/* SingerId= */ 18L, "Maya", "Patel"));
5151

5252
for (Singer singer : singers) {
5353
// Note that JDBC parameters start at index 1.

0 commit comments

Comments
 (0)