You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2023/12/12 12:14:22 UTC

(sling-parent) branch feature/spotless-maven-plugin created (now a27692e)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch feature/spotless-maven-plugin
in repository https://gitbox.apache.org/repos/asf/sling-parent.git


      at a27692e  SLING-12186 Enforce source code formatting with spotless-maven-plugin

This branch includes the following new commits:

     new a27692e  SLING-12186 Enforce source code formatting with spotless-maven-plugin

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(sling-parent) 01/01: SLING-12186 Enforce source code formatting with spotless-maven-plugin

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/spotless-maven-plugin
in repository https://gitbox.apache.org/repos/asf/sling-parent.git

commit a27692e10716699d2172ea1fb868dc3467159eab
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Dec 12 13:14:17 2023 +0100

    SLING-12186 Enforce source code formatting with spotless-maven-plugin
    
    Use Palantir Java Formatter and Sort POM plugin
---
 sling-parent/pom.xml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/sling-parent/pom.xml b/sling-parent/pom.xml
index ab49b4d..0741946 100644
--- a/sling-parent/pom.xml
+++ b/sling-parent/pom.xml
@@ -272,6 +272,56 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- automatically enforce common source formatting -->
+            <plugin>
+                <groupId>com.diffplug.spotless</groupId>
+                <artifactId>spotless-maven-plugin</artifactId>
+                <configuration>
+                    <java>
+                        <!-- orders of used formatters are important MPOM-376 -->
+                        <!-- eg. palantir override importOrder, so should be first -->
+                        <palantirJavaFormat>
+                            <version>2.39.0</version>
+                        </palantirJavaFormat>
+                        <removeUnusedImports />
+                        <!-- https://github.com/diffplug/spotless/tree/main/plugin-maven#java -->
+                        <importOrder>
+                            <order>javax,java,,\#</order> <!-- static imports last -->
+                        </importOrder>
+                        <!-- use common ASF license header from https://github.com/apache/maven-shared-resources/blob/master/src/main/resources/config/maven-header-plain.txt  -->
+                        <licenseHeader>
+                            <file>config/maven-header-plain.txt</file>
+                        </licenseHeader>
+                    </java>
+                    <pom>
+                        <sortPom>
+                            <expandEmptyElements>false</expandEmptyElements>
+                            <!-- https://issues.apache.org/jira/browse/MRELEASE-1111 -->
+                            <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
+                            <!-- Indentation -->
+                            <nrOfIndentSpace>4</nrOfIndentSpace>
+                        </sortPom>
+                    </pom>
+                    <upToDateChecking>
+                        <enabled>true</enabled>
+                    </upToDateChecking>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.maven.shared</groupId>
+                        <artifactId>maven-shared-resources</artifactId>
+                        <version>5</version>
+                    </dependency>
+                </dependencies>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>process-sources</phase>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
 
         <pluginManagement>
@@ -346,6 +396,11 @@
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>com.diffplug.spotless</groupId>
+                    <artifactId>spotless-maven-plugin</artifactId>
+                    <version>2.41.1</version>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>