- This issue is related maven plugin for formatting & validating XML file.
- Below is the sample code that I am using in
pom.xml file.
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>1.23.0</version>
<configuration>
<formats>
<format>
<encoding>Cp1252</encoding>
<includes>
<include>pom.xml</include>
</includes>
<eclipseWtp>
<type>XML</type>
<files>
<file>${basedir}/DevStyleXml.prefs</file>
</files>
<version>4.7.3a</version>
</eclipseWtp>
</format>
</formats>
<encoding>US-ASCII</encoding>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
DevStyleXml.prefs
eclipse.preferences.version=1
indentationChar=tab
indentationSize=1
lineWidth=999
Also tried with below.
eclipse.preferences.version=1
indentationChar=space
indentationSize=2
lineWidth=999
- Also added .gitattributes with the following content.
In another trail, use the below content.
- Spotless Version : 1.23.0
- Issue : It's working fine in local systems (Windows, Mac, Unix) in developer's system. But failing in Jenkins. Below is the stacktrace in Jenkins.
20:56:45 [ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:1.23.0:check (default) on project ie-batch: The following files had format violations:
20:56:45 [ERROR] pom.xml
20:56:45 [ERROR] @@ -1,25 +1,24 @@
20:56:45 [ERROR] <?xml?version="1.0"?encoding="UTF-8"?>
20:56:45 [ERROR] -<project?xsi:schemaLocation="http://maven.apache.org/POM/4.0.0?http://maven.apache.org/xsd/maven-4.0.0.xsd"?xmlns="http://maven.apache.org/POM/4.0.0"
20:56:45 [ERROR] -????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20:56:45 [ERROR] -??<modelVersion>4.0.0</modelVersion>
20:56:45 [ERROR] -??<parent>
I am not sure, whether I am missing anything here or it's a defect.
pom.xmlfile.Also tried with below.
In another trail, use the below content.
I am not sure, whether I am missing anything here or it's a defect.