You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<rule-subtitle>Adhere to the Standard Directory Layout</rule-subtitle>
138
142
</rule-header>
139
143
<rule-description>
140
-
<![CDATA[Follow Maven's convention for directory structure (`src/main/java`, `src/main/resources`, `src/test/java`, `src/test/resources`, etc.). This makes projects easier to understand and build, as Maven relies on these defaults.]]>
144
+
<![CDATA[
145
+
Follow Maven's convention for directory structure (`src/main/java`, `src/main/resources`, `src/test/java`, `src/test/resources`, etc.). This makes projects easier to understand and build, as Maven relies on these defaults.
146
+
]]>
141
147
</rule-description>
142
148
<code-examples>
143
149
<good-example>
@@ -179,11 +185,14 @@ my-app/
179
185
<rule-subtitle>Manage Plugin Versions and Configurations Centrally</rule-subtitle>
180
186
</rule-header>
181
187
<rule-description>
182
-
<![CDATA[Use `<pluginManagement>` in a parent POM to define plugin versions and common configurations. Child POMs can then use the plugins without specifying versions, ensuring consistency. Override configurations in child POMs only when necessary.]]>
188
+
<![CDATA[
189
+
Use `<pluginManagement>` in a parent POM to define plugin versions and common configurations. Child POMs can then use the plugins without specifying versions, ensuring consistency. Override configurations in child POMs only when necessary.
<rule-subtitle>Employ Build Profiles for Environment-Specific Settings</rule-subtitle>
246
258
</rule-header>
247
259
<rule-description>
248
-
<![CDATA[Use Maven profiles to customize build settings for different environments (e.g., dev, test, prod) or other conditional scenarios. This can include different dependencies, plugin configurations, or properties. Activate profiles via command line, OS, JDK, or file presence.]]>
260
+
<![CDATA[
261
+
Use Maven profiles to customize build settings for different environments (e.g., dev, test, prod) or other conditional scenarios. This can include different dependencies, plugin configurations, or properties. Activate profiles via command line, OS, JDK, or file presence.
<database.url>jdbc:postgresql://prodserver/mydb</database.url> <!-- Manually switch by commenting/uncommenting -->
305
319
</properties>
306
-
</project>]]></code-block>
320
+
</project>
321
+
]]></code-block>
307
322
</bad-example>
308
323
</code-examples>
309
324
</rule-section>
@@ -314,7 +329,9 @@ my-app/
314
329
<rule-subtitle>Structure POMs Logically for Readability</rule-subtitle>
315
330
</rule-header>
316
331
<rule-description>
317
-
<![CDATA[Organize your `pom.xml` sections in a consistent order (e.g., project coordinates, parent, properties, dependencyManagement, dependencies, build, profiles, repositories). Use properties for recurring versions or values. Add comments for complex configurations.]]>
332
+
<![CDATA[
333
+
Organize your `pom.xml` sections in a consistent order (e.g., project coordinates, parent, properties, dependencyManagement, dependencies, build, profiles, repositories). Use properties for recurring versions or values. Add comments for complex configurations.
334
+
]]>
318
335
</rule-description>
319
336
<code-examples>
320
337
<good-example>
@@ -367,7 +384,8 @@ my-app/
367
384
368
385
<!-- Repositories and Plugin Repositories (if needed) -->
369
386
<!-- ... -->
370
-
</project>]]></code-block>
387
+
</project>
388
+
]]></code-block>
371
389
</good-example>
372
390
<bad-example>
373
391
<code-blocklanguage="xml"><![CDATA[
@@ -390,7 +408,8 @@ my-app/
390
408
</properties>
391
409
<artifactId>my-app</artifactId>
392
410
<version>1.0.0-SNAPSHOT</version>
393
-
</project>]]></code-block>
411
+
</project>
412
+
]]></code-block>
394
413
</bad-example>
395
414
</code-examples>
396
415
</rule-section>
@@ -401,7 +420,9 @@ my-app/
401
420
<rule-subtitle>Declare Custom Repositories Explicitly and Minimize Their Use</rule-subtitle>
402
421
</rule-header>
403
422
<rule-description>
404
-
<![CDATA[Prefer dependencies from Maven Central. If custom repositories are necessary, declare them in the `<repositories>` section and `<pluginRepositories>` for plugins. It's often better to manage these in a company-wide Nexus/Artifactory instance configured in `settings.xml` rather than per-project POMs. Avoid relying on transitive repositories.]]>
423
+
<![CDATA[
424
+
Prefer dependencies from Maven Central. If custom repositories are necessary, declare them in the `<repositories>` section and `<pluginRepositories>` for plugins. It's often better to manage these in a company-wide Nexus/Artifactory instance configured in `settings.xml` rather than per-project POMs. Avoid relying on transitive repositories.
425
+
]]>
405
426
</rule-description>
406
427
<code-examples>
407
428
<good-example>
@@ -421,7 +442,8 @@ my-app/
421
442
</pluginRepository>
422
443
</pluginRepositories>
423
444
</project>
424
-
<!-- Better: Configure these in settings.xml and use a repository manager -->]]></code-block>
445
+
<!-- Better: Configure these in settings.xml and use a repository manager -->
446
+
]]></code-block>
425
447
</good-example>
426
448
<bad-example>
427
449
<code-blocklanguage="xml"><![CDATA[
@@ -438,7 +460,8 @@ my-app/
438
460
Relying on implicit configurations makes builds less portable. -->
439
461
</dependency>
440
462
</dependencies>
441
-
</project>]]></code-block>
463
+
</project>
464
+
]]></code-block>
442
465
</bad-example>
443
466
</code-examples>
444
467
</rule-section>
@@ -449,7 +472,9 @@ my-app/
449
472
<rule-subtitle>Use Properties to Manage Dependency and Plugin Versions</rule-subtitle>
450
473
</rule-header>
451
474
<rule-description>
452
-
<![CDATA[Define all dependency and plugin versions in the `<properties>` section rather than hardcoding them throughout the POM. This centralizes version management, makes updates easier, reduces duplication, and helps maintain consistency across related dependencies. Use consistent property naming conventions: `maven-plugin-[name].version` for Maven plugins, simple names like `[library].version` for dependencies, and descriptive names for quality thresholds like `coverage.level`.]]>
475
+
<![CDATA[
476
+
Define all dependency and plugin versions in the `<properties>` section rather than hardcoding them throughout the POM. This centralizes version management, makes updates easier, reduces duplication, and helps maintain consistency across related dependencies. Use consistent property naming conventions: `maven-plugin-[name].version` for Maven plugins, simple names like `[library].version` for dependencies, and descriptive names for quality thresholds like `coverage.level`.
477
+
]]>
453
478
</rule-description>
454
479
<code-examples>
455
480
<good-example>
@@ -530,10 +555,12 @@ my-app/
530
555
</plugin>
531
556
</plugins>
532
557
</build>
533
-
</project>]]></code-block>
558
+
</project>
559
+
]]></code-block>
534
560
</good-example>
535
561
<bad-example>
536
-
<code-blocklanguage="xml"><![CDATA[<!-- Hardcoded versions scattered throughout the POM -->
562
+
<code-blocklanguage="xml"><![CDATA[
563
+
<!-- Hardcoded versions scattered throughout the POM -->
0 commit comments