Git Product home page Git Product logo

xml-format's Introduction

Maven XML Formatter Plugin

This Maven plugin automatically formats XML files.

This plugin ensures all your XML files look and feel the same, with consistent indentation and whitespace conversion. It will avoid modifying files if they are already in the correct format. You can select to use tabs or four spaces for indentation.

We have tested this plugin extensively with large projects using many Maven POMs and Simple Binary Encoding schemas. Just use a comment block or CDATA if you'd like to preserve specific formatting (eg legal messages etc).

Usage

You do not need to clone this GitHub repository to use the fork. You can use it immediately by making two simple changes to your project's pom.xml.

First, declare this project as a plugin repository:

    <pluginRepositories>
        <pluginRepository>
            <id>maven-xml-formatter-plugin</id>
            <name>Maven2 XML Formatter Plugin repository</name>
            <url>https://raw.github.com/benalexau/xml-formatter/master/releases/</url>
        </pluginRepository>
    </pluginRepositories>

Second, enable the plugin. Example configuration settings are shown below which will cause reformatting any time the "verify" lifecycle phase is run. It also shows the various properties you can customize.

    <build>
        <plugins>
            <plugin>
                <groupId>org.technicalsoftwareconfigurationmanagement.maven-plugin</groupId>
                <artifactId>tscm-maven-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <useTabs>false</useTabs>
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                    <excludes>
                        <exclude>**/target/**</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>xmlFormatter</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

If you would prefer to only run XML formatting on request, you can omit the executions element above and instead run mvn tscm:xmlFormatter.

History

Originally this project was on Google Code, but it hasn't been maintained since 2011. A patch was submitted upstream back in 2011, but no response was ever received. With Google Code presently in read-only mode and winding up its service, this GitHub project is happy to accept improvements to the plugin.

For archival purposes independent of Google Code, a Way Back Machine snapshot of the original Google Code project can be viewed here. It is noted the displayed license is Apache Software License, Version 2.0 and therefore the ASLv2 license file been added to the source repository here for licensing clarity.

xml-format's People

Contributors

benalexau avatar

Watchers

Dinesh Wijekoon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.