Skip to content

Commit 063ff76

Browse files
authored
Enable code formatting with spotless and Google Code formatter (#722)
This PR applies the Google Code formatter to the source code. It is also ensured that the code formatting is ensured in PR with spottles check goal.
1 parent 5d80484 commit 063ff76

7 files changed

Lines changed: 410 additions & 383 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ User Interface related Features:
5959

6060
CDS Maven Plugin Features:
6161

62-
- Install [Node.js](srv/pom.xml#L161) in the default version.
63-
- Execute arbitrary [npm](srv/pom.xml#L161) commands.
64-
- [Generate](srv/pom.xml#L193) Java POJOs for type-safe access to the CDS model.
65-
- [Clean](srv/pom.xml#L154) project from artifacts of the previous build.
62+
- Install [Node.js](srv/pom.xml#L147) in the default version.
63+
- Execute arbitrary [npm](srv/pom.xml#L164) commands.
64+
- [Generate](srv/pom.xml#L179) Java POJOs for type-safe access to the CDS model.
65+
- [Clean](srv/pom.xml#L140) project from artifacts of the previous build.
6666

6767
# Getting Started
6868

‎pom.xml‎

Lines changed: 163 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,177 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0"
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
54

6-
<groupId>my</groupId>
7-
<artifactId>bookshop-parent</artifactId>
8-
<version>${revision}</version>
9-
<packaging>pom</packaging>
5+
<groupId>my</groupId>
6+
<artifactId>bookshop-parent</artifactId>
7+
<version>${revision}</version>
8+
<packaging>pom</packaging>
109

11-
<name>bookshop parent</name>
10+
<name>bookshop parent</name>
1211

13-
<properties>
14-
<!-- OUR VERSION -->
15-
<revision>1.0.0-SNAPSHOT</revision>
12+
<modules>
13+
<module>srv</module>
14+
</modules>
1615

17-
<!-- DEPENDENCIES VERSION -->
18-
<jdk.version>25</jdk.version>
19-
<cds.services.version>5.1.1</cds.services.version>
20-
<spring.boot.version>4.1.1</spring.boot.version>
21-
<cf-java-logging-support.version>4.3.0</cf-java-logging-support.version>
22-
<testcontainers.version>1.21.4</testcontainers.version>
23-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24-
</properties>
16+
<properties>
17+
<!-- OUR VERSION -->
18+
<revision>1.0.0-SNAPSHOT</revision>
2519

26-
<modules>
27-
<module>srv</module>
28-
</modules>
20+
<!-- DEPENDENCIES VERSION -->
21+
<jdk.version>25</jdk.version>
22+
<cds.services.version>5.1.1</cds.services.version>
23+
<spring.boot.version>4.1.1</spring.boot.version>
24+
<cf-java-logging-support.version>4.3.0</cf-java-logging-support.version>
25+
<testcontainers.version>1.21.4</testcontainers.version>
26+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
27+
</properties>
2928

30-
<dependencyManagement>
31-
<dependencies>
32-
<!-- CDS SERVICES -->
33-
<dependency>
34-
<groupId>com.sap.cds</groupId>
35-
<artifactId>cds-services-bom</artifactId>
36-
<version>${cds.services.version}</version>
37-
<type>pom</type>
38-
<scope>import</scope>
39-
</dependency>
29+
<dependencyManagement>
30+
<dependencies>
31+
<!-- CDS SERVICES -->
32+
<dependency>
33+
<groupId>com.sap.cds</groupId>
34+
<artifactId>cds-services-bom</artifactId>
35+
<version>${cds.services.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
4039

41-
<!-- SPRING BOOT -->
42-
<dependency>
43-
<groupId>org.springframework.boot</groupId>
44-
<artifactId>spring-boot-dependencies</artifactId>
45-
<version>${spring.boot.version}</version>
46-
<type>pom</type>
47-
<scope>import</scope>
48-
</dependency>
49-
</dependencies>
50-
</dependencyManagement>
40+
<!-- SPRING BOOT -->
41+
<dependency>
42+
<groupId>org.springframework.boot</groupId>
43+
<artifactId>spring-boot-dependencies</artifactId>
44+
<version>${spring.boot.version}</version>
45+
<type>pom</type>
46+
<scope>import</scope>
47+
</dependency>
48+
</dependencies>
49+
</dependencyManagement>
5150

52-
<build>
53-
<pluginManagement>
54-
<plugins>
55-
<!-- MAKE CDS PLUGIN RUNNABLE FROM ROOT -->
56-
<plugin>
57-
<groupId>com.sap.cds</groupId>
58-
<artifactId>cds-maven-plugin</artifactId>
59-
<version>${cds.services.version}</version>
60-
</plugin>
61-
</plugins>
62-
</pluginManagement>
51+
<build>
52+
<pluginManagement>
53+
<plugins>
54+
<!-- MAKE CDS PLUGIN RUNNABLE FROM ROOT -->
55+
<plugin>
56+
<groupId>com.sap.cds</groupId>
57+
<artifactId>cds-maven-plugin</artifactId>
58+
<version>${cds.services.version}</version>
59+
</plugin>
60+
</plugins>
61+
</pluginManagement>
6362

64-
<plugins>
65-
<!-- JAVA VERSION -->
66-
<plugin>
67-
<groupId>org.apache.maven.plugins</groupId>
68-
<artifactId>maven-compiler-plugin</artifactId>
69-
<version>3.16.0</version>
70-
<configuration>
71-
<release>${jdk.version}</release>
72-
<encoding>UTF-8</encoding>
73-
</configuration>
74-
</plugin>
63+
<plugins>
64+
<!-- JAVA VERSION -->
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-compiler-plugin</artifactId>
68+
<version>3.16.0</version>
69+
<configuration>
70+
<release>${jdk.version}</release>
71+
<encoding>UTF-8</encoding>
72+
</configuration>
73+
</plugin>
7574

76-
<!-- MAKE SPRING BOOT PLUGIN RUNNABLE FROM ROOT -->
77-
<plugin>
78-
<groupId>org.springframework.boot</groupId>
79-
<artifactId>spring-boot-maven-plugin</artifactId>
80-
<version>${spring.boot.version}</version>
81-
<configuration>
82-
<skip>true</skip>
83-
</configuration>
84-
</plugin>
75+
<!-- MAKE SPRING BOOT PLUGIN RUNNABLE FROM ROOT -->
76+
<plugin>
77+
<groupId>org.springframework.boot</groupId>
78+
<artifactId>spring-boot-maven-plugin</artifactId>
79+
<version>${spring.boot.version}</version>
80+
<configuration>
81+
<skip>true</skip>
82+
</configuration>
83+
</plugin>
8584

86-
<!-- SUREFIRE PLUGIN -->
87-
<plugin>
88-
<groupId>org.apache.maven.plugins</groupId>
89-
<artifactId>maven-surefire-plugin</artifactId>
90-
<version>3.6.0</version>
91-
<configuration>
92-
<failIfNoTests>true</failIfNoTests>
93-
</configuration>
94-
</plugin>
85+
<!-- SUREFIRE PLUGIN -->
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-surefire-plugin</artifactId>
89+
<version>3.6.0</version>
90+
<configuration>
91+
<failIfNoTests>true</failIfNoTests>
92+
</configuration>
93+
</plugin>
9594

96-
<!-- POM FLATTENING FOR CI FRIENDLY VERSIONS -->
97-
<plugin>
98-
<groupId>org.codehaus.mojo</groupId>
99-
<artifactId>flatten-maven-plugin</artifactId>
100-
<version>1.8.0</version>
101-
<configuration>
102-
<updatePomFile>true</updatePomFile>
103-
<flattenMode>resolveCiFriendliesOnly</flattenMode>
104-
</configuration>
105-
<executions>
106-
<execution>
107-
<id>flatten</id>
108-
<phase>process-resources</phase>
109-
<goals>
110-
<goal>flatten</goal>
111-
</goals>
112-
</execution>
113-
<execution>
114-
<id>flatten.clean</id>
115-
<phase>clean</phase>
116-
<goals>
117-
<goal>clean</goal>
118-
</goals>
119-
</execution>
120-
</executions>
121-
</plugin>
95+
<!-- POM FLATTENING FOR CI FRIENDLY VERSIONS -->
96+
<plugin>
97+
<groupId>org.codehaus.mojo</groupId>
98+
<artifactId>flatten-maven-plugin</artifactId>
99+
<version>1.8.0</version>
100+
<configuration>
101+
<updatePomFile>true</updatePomFile>
102+
<flattenMode>resolveCiFriendliesOnly</flattenMode>
103+
</configuration>
104+
<executions>
105+
<execution>
106+
<id>flatten</id>
107+
<goals>
108+
<goal>flatten</goal>
109+
</goals>
110+
<phase>process-resources</phase>
111+
</execution>
112+
<execution>
113+
<id>flatten.clean</id>
114+
<goals>
115+
<goal>clean</goal>
116+
</goals>
117+
<phase>clean</phase>
118+
</execution>
119+
</executions>
120+
</plugin>
122121

123-
<!-- PROJECT STRUCTURE CHECKS -->
124-
<plugin>
125-
<groupId>org.apache.maven.plugins</groupId>
126-
<artifactId>maven-enforcer-plugin</artifactId>
127-
<version>3.6.3</version>
128-
<executions>
129-
<execution>
130-
<id>Project Structure Checks</id>
131-
<goals>
132-
<goal>enforce</goal>
133-
</goals>
134-
<configuration>
135-
<rules>
136-
<requireMavenVersion>
137-
<version>3.9.14</version>
138-
</requireMavenVersion>
139-
<requireJavaVersion>
140-
<version>${jdk.version}</version>
141-
</requireJavaVersion>
142-
<reactorModuleConvergence />
143-
</rules>
144-
<fail>true</fail>
145-
</configuration>
146-
</execution>
147-
</executions>
148-
</plugin>
149-
</plugins>
150-
</build>
122+
<!-- PROJECT STRUCTURE CHECKS -->
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-enforcer-plugin</artifactId>
126+
<version>3.6.3</version>
127+
<executions>
128+
<execution>
129+
<id>Project Structure Checks</id>
130+
<goals>
131+
<goal>enforce</goal>
132+
</goals>
133+
<configuration>
134+
<rules>
135+
<requireMavenVersion>
136+
<version>3.9.14</version>
137+
</requireMavenVersion>
138+
<requireJavaVersion>
139+
<version>${jdk.version}</version>
140+
</requireJavaVersion>
141+
<reactorModuleConvergence/>
142+
</rules>
143+
<fail>true</fail>
144+
</configuration>
145+
</execution>
146+
</executions>
147+
</plugin>
148+
<!-- CODE FORMATTING -->
149+
<plugin>
150+
<groupId>com.diffplug.spotless</groupId>
151+
<artifactId>spotless-maven-plugin</artifactId>
152+
<version>3.10.2</version>
153+
<configuration>
154+
<java>
155+
<googleJavaFormat>
156+
<style>GOOGLE</style>
157+
</googleJavaFormat>
158+
</java>
159+
<pom>
160+
<includes>
161+
<include>pom.xml</include>
162+
</includes>
163+
<sortPom/>
164+
</pom>
165+
</configuration>
166+
<executions>
167+
<execution>
168+
<goals>
169+
<goal>check</goal>
170+
</goals>
171+
<phase>process-sources</phase>
172+
</execution>
173+
</executions>
174+
</plugin>
175+
</plugins>
176+
</build>
151177
</project>

0 commit comments

Comments
 (0)