View documentation at: https://code.revelc.net/revelc
Parent pom for revelc projects
This plugin uses a 1-up counter for its versioning.
XML formatter for use with net.revelc formatter-maven-plugin
License: Eclipse Public License 2.0
View documentation at: https://code.revelc.net/revelc
Parent pom for revelc projects
This plugin uses a 1-up counter for its versioning.
This issue is pretty self-explanatory. Instead of using the name "master", the default branch should be named "main".
This is consistent with the actions taken by major tech leaders, including GitHub itself, to begin phasing out the use of potentially-harmful terminology in tech.
commons-io is only being used for test purposes to read in file content. This can be done natively in java 8 just as easily.
In some cases, the internet is not available (e.g. corporate proxy). We then encounter the following kind of errors:
Caused by: java.net.UnknownHostException: www.puppycrawl.com
at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect (PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392)
at java.net.Socket.connect (Socket.java:589)
at java.net.Socket.connect (Socket.java:538)
at sun.net.NetworkClient.doConnect (NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer (HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer (HttpClient.java:558)
at sun.net.www.http.HttpClient.<init> (HttpClient.java:242)
at sun.net.www.http.HttpClient.New (HttpClient.java:339)
at sun.net.www.http.HttpClient.New (HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient (HttpURLConnection.java:1220)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0 (HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect (HttpURLConnection.java:1050)
at sun.net.www.protocol.http.HttpURLConnection.connect (HttpURLConnection.java:984)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0 (HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream (HttpURLConnection.java:1492)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity (XMLEntityManager.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity (XMLEntityManager.java:1304)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity (XMLEntityManager.java:1270)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource (XMLDTDScannerImpl.java:264)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch (XMLDocumentScannerImpl.java:1161)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next (XMLDocumentScannerImpl.java:1045)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next (XMLDocumentScannerImpl.java:959)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse (SAXParserImpl.java:643)
at net.revelc.code.formatter.xml.lib.XmlDocumentFormatter.validateWellFormedness (XmlDocumentFormatter.java:115)
at net.revelc.code.formatter.xml.lib.XmlDocumentFormatter.format (XmlDocumentFormatter.java:77)
at net.revelc.code.formatter.xml.XMLFormatter.doFormat (XMLFormatter.java:54)
at net.revelc.code.formatter.AbstractCacheableFormatter.formatFile (AbstractCacheableFormatter.java:47)
at net.revelc.code.formatter.FormatterMojo.doFormatFile (FormatterMojo.java:530)
at net.revelc.code.formatter.FormatterMojo.formatFile (FormatterMojo.java:464)
at net.revelc.code.formatter.FormatterMojo.execute (FormatterMojo.java:344)
Would it be possible to add an option to skip XML validation, as suggested in https://stackoverflow.com/questions/4002885/unknown-host-exception-while-parsing-an-xml-file ?
Version needs bumped to 0.3.0
This ticket is more of a communication ticket that this is ready for release and before its released allowing team to discuss if anything else was deemed necessary for the above noted changes before release is cut. Expecting to get this into formatter for 2022-12 eclipse support immediately after.
I have a use case where I put notes beside property versions as comments for next version to upgrade to.
Example
<xml-formatter.version>0.1.0</xml-formatter.version> <!-- TODO: Bump to 0.1.1 -->
It would be nice to be able to keep this on same line. No xml formatter thus far has been able to do so.
Example property for this.
keepCommentsSameLine=true
What occurs now..
<xml-formatter.version>0.1.0</xml-formatter.version>
<!-- TODO: Bump to 0.1.1 -->
-<!DOCTYPE project [
-<!ENTITY deps SYSTEM “ant/deps.xml”>
-<!ENTITY core SYSTEM “ant/core.xml”>
-<!ENTITY packages SYSTEM “ant/packages.xml”>
-<!ENTITY tests SYSTEM “ant/tests.xml”>
-]>
+<!DOCTYPE project>
+<!--ENTITY core SYSTEM “ant/core.xml”-->
+<!--ENTITY packages SYSTEM “ant/packages.xml”-->
+<!--ENTITY tests SYSTEM “ant/tests.xml”-->
+ ]>
Fixes #3
Describe the bug
With certain multi-line comments, indentation happens with every execution on the formatter-maven-plugin
.
Versions (OS, Maven, Java, and others, as appropriate):
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /home/jperkins/apps/maven
Java version: 17.0.8, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.8.0.7-1.fc38.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.5.7-200.fc38.x86_64", arch: "amd64", family: "unix"
To Reproduce
Add some generic XML and add a multi-line comment that ends with -->
after a tag. Example XML:
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>RESTEASY-1103</display-name>
<context-param>
<param-name>resteasy.document.secure.processing.feature</param-name>
<param-value>true</param-value>
</context-param>
<!--context-param>
<param-name>resteasy.document.secure.disableDTDs</param-name>
<param-value></param-value>
</context-param-->
<context-param>
<param-name>resteasy.document.expand.entity.references</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>jakarta.ws.rs.Application</param-name>
<param-value>org.jboss.resteasy.utils.TestApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Note the commented out segment re-indents with every execution of the formatter-maven-plugin
. If you change the comment from </context-param-->
to </context-param> -->
, in other words don't use the ending >
as the tag delimiter, it seems to fix it.
Expected behavior
The indentation should only happen once, if at all.
Additional context
You can see the results or reproduce it with this PR resteasy/resteasy#3874. Note that it also seems to be stripping some leading spaces in the XML comments. That's easier to workaround though.
Empty lines are not deleted from the xml document. I tried to look around the settings to find a configuration option to delete new lines/extra new lines from the xml document. Is there anything available?
Versions (OS, Maven, Java, and others, as appropriate):
To Reproduce
Steps to reproduce the behavior (or a link to an example repository that reproduces the problem):
Sample XML file:
<root>
<node1> text </node1>
<node2>text2</node2>
</root>
Expected behavior
<root>
<node1> text </node1>
<node2>text2</node2>
</root>
Today this repo is using system out which is horrible design solution. It is further only used by the formatter-maven-plugin and the slf4j-api is already present there. Further maven uses slf4j-api as well. So rather than be flagged in code with bad usage, lets just add the api and fix the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.