Skip to content

Commit acb74d5

Browse files
committed
Initial works to add spotless
1 parent 23cee4f commit acb74d5

File tree

2 files changed

+40
-37
lines changed

2 files changed

+40
-37
lines changed

.cursor/rules/templates/java-maven-plugins-template.md

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,7 @@ This template provides Maven plugin configurations that should be added conditio
66

77
## Core Plugins
88

9-
### Add maven-plugin-enforcer (Enhanced)
10-
11-
**When to use**: Always recommended for build consistency and dependency management.
12-
**User question**: "Do you want enhanced dependency validation and build enforcement? (y/n)"
13-
14-
Nature: General
15-
Category: Build
16-
17-
Update the pom.xml with this enhanced enforcer plugin:
18-
19-
```xml
20-
<plugin>
21-
<groupId>org.codehaus.mojo</groupId>
22-
<artifactId>flatten-maven-plugin</artifactId>
23-
<version>${maven-plugin-flatten.version}</version>
24-
<configuration>
25-
</configuration>
26-
<executions>
27-
<execution>
28-
<id>flatten</id>
29-
<phase>process-resources</phase>
30-
<goals>
31-
<goal>flatten</goal>
32-
</goals>
33-
</execution>
34-
<execution>
35-
<id>flatten.clean</id>
36-
<phase>clean</phase>
37-
<goals>
38-
<goal>clean</goal>
39-
</goals>
40-
</execution>
41-
</executions>
42-
</plugin>
43-
```
44-
45-
## Add maven-plugin-enforcer
9+
### Add maven-plugin-enforcer
4610

4711
Nature: General
4812
Category: Build
@@ -157,6 +121,44 @@ Update the pom.xml with this new plugin:
157121

158122
## Optional Build Enhancement Plugins
159123

124+
### Add spotless-maven-plugin
125+
126+
Nature: General
127+
Category: Build
128+
129+
Update the pom.xml with this plugin:
130+
131+
```xml
132+
<plugin>
133+
<groupId>com.diffplug.spotless</groupId>
134+
<artifactId>spotless-maven-plugin</artifactId>
135+
<version>${maven-plugin-spotless.version}</version>
136+
<configuration>
137+
<encoding>UTF-8</encoding>
138+
<java>
139+
<removeUnusedImports />
140+
<importOrder>
141+
<order>,\#</order>
142+
</importOrder>
143+
<endWithNewline />
144+
<trimTrailingWhitespace />
145+
<indent>
146+
<spaces>true</spaces>
147+
<spacesPerTab>4</spacesPerTab>
148+
</indent>
149+
</java>
150+
</configuration>
151+
<executions>
152+
<execution>
153+
<goals>
154+
<goal>check</goal>
155+
</goals>
156+
<phase>process-sources</phase>
157+
</execution>
158+
</executions>
159+
</plugin>
160+
```
161+
160162
### Add flatten-maven-plugin
161163

162164
**When to use**: For library projects that will be published to Maven repositories.

.cursor/rules/templates/java-maven-questions-template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Options:
2828
**What build and quality aspects are important for your project?** (Select all that apply)
2929

3030
Options:
31+
_ Format source code (Spotless)
3132
- Compiler behaviour improvements with ErrorProne + NullAway (Ask for JSpecify)
3233
- Integration testing (Failsafe)
3334
- Code coverage reporting (JaCoCo)

0 commit comments

Comments
 (0)