Use Spotless sortpom plug-in (#4618)

This simplifies the sortpom configuration and also allows for checking and reformatting them using the spotless:check and spotless:apply Maven goals.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2025-02-23 19:04:47 +01:00
committed by GitHub
parent fd53c4cb1d
commit 6bf59605bd
142 changed files with 300 additions and 338 deletions
+16 -53
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -74,7 +74,7 @@
<sat.version>0.17.0</sat.version>
<slf4j.version>2.0.16</slf4j.version>
<xtext.version>2.37.0</xtext.version>
<spotless.version>2.43.0</spotless.version>
<spotless.version>2.44.3</spotless.version>
<!-- Eclipse Java formatter version 4.26+ does not check test files -->
<spotless.eclipse.version>4.25</spotless.eclipse.version>
<spotless.eclipse.wtp.version>4.21.0</spotless.eclipse.wtp.version>
@@ -340,15 +340,13 @@ Import-Package: \\
<!-- The search function is broken without the workaround below -->
<!-- See: https://stackoverflow.com/questions/52326318/maven-javadoc-search-redirects-to-undefined-url -->
<additionalJOption>--allow-script-in-comments</additionalJOption>
<bottom>
<![CDATA[
<bottom><![CDATA[
<script>
if (typeof useModuleDirectories !== 'undefined') {
useModuleDirectories = false;
}
</script>
]]>
</bottom>
]]></bottom>
<tags>
<tag>
<name>apiNote</name>
@@ -402,10 +400,8 @@ Import-Package: \\
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<argLine>
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
<argLine>--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
<systemPropertyVariables>
<junit.jupiter.execution.timeout.default>15 m</junit.jupiter.execution.timeout.default>
</systemPropertyVariables>
@@ -523,29 +519,6 @@ Import-Package: \\
</executions>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>4.0.0</version>
<configuration>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<createBackupFile>false</createBackupFile>
<keepBlankLines>true</keepBlankLines>
</configuration>
<executions>
<execution>
<id>sortpom-verify</id>
<goals>
<goal>verify</goal>
</goals>
<phase>verify</phase>
<configuration>
<verifyFail>Stop</verifyFail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
@@ -562,6 +535,15 @@ Import-Package: \\
</importOrder>
<endWithNewline/>
</java>
<pom>
<sortPom>
<expandEmptyElements>false</expandEmptyElements>
<indentAttribute>schemaLocation</indentAttribute>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<sortDependencyExclusions/>
<sortDependencyManagement/>
</sortPom>
</pom>
<formats>
<format>
<!-- *.xml -->
@@ -598,21 +580,6 @@ Import-Package: \\
<trimTrailingWhitespace/>
<endWithNewline/>
</format>
<format>
<!-- pom.xml -->
<includes>
<include>pom.xml</include>
</includes>
<eclipseWtp>
<type>XML</type>
<files>
<file>openhab_wst_pom_file.prefs</file>
</files>
<version>${spotless.eclipse.wtp.version}</version>
</eclipseWtp>
<trimTrailingWhitespace/>
<endWithNewline/>
</format>
</formats>
</configuration>
<dependencies>
@@ -675,10 +642,6 @@ Import-Package: \\
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>