The xml-maven-plugin
plugin is for general tasks related to XML, XSD, and XSLT.
This plugin supports XML Schema 1.1.
Note This plugin is not related to
xml-maven-plugin
from CodeHaus.
xml:validate
validates XML or XSD documents against schema(s) specified in thexsi:schemaLocation
attribute.xml:transform
transforms XML documents by applying XSLT stylesheets.
The xml:validate
goal is bound to the compile
phase, and is used to validate XML documents against schema(s) specified in the xsi:schemaLocation
attribute. The validator uses a SAX parser and supports XML Schema 1.1.
Execution with includes
directive.
<plugin>
<groupId>org.openjax.xml</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>0.9.5</version>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<includes>
<include>**/*.xsd</include>
<include>**/*.xml</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Execution with includes
and excludes
directives.
<plugin>
<groupId>org.openjax.xml</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>0.9.5</version>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<includes>
<include>**/*.xml</include>
<include>**/*.xsd</include>
</includes>
<excludes>
<exclude>**/willfail.xml</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Execution with includes
, excludes
, and resources
directives.
<plugin>
<groupId>org.openjax.xml</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>0.9.5</version>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<includes>
<include>**/*.xml</include>
<include>**/*.xsd</include>
</includes>
<excludes>
<exclude>**/willfail.xml</exclude>
</excludes>
<resources>
<resource>i-am-on-the-classpath.xml</resource>
<resource>META-INF/maven/plugin.xml</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Name | Type | Use | Description |
---|---|---|---|
/skip¹ | Boolean | Optional | Skip executioin. Default: false . |
/includes¹ | List | Optional | List of include patterns. Default: null . |
/includes/includeⁿ | String | Optional | Pattern of files to include. Default: null . |
/excludes¹ | List | Optional | List of exclude patterns. Default: null . |
/excludes/excludeⁿ | String | Optional | Pattern of files to exclude. Default: null . |
/resources¹ | List | Optional | List of resource names. Default: null . |
/resources/resourceⁿ | String | Optional | Resource name on the classpath. Default: null . |
- Running Maven in offline mode (
mvn -o
) will causexml:validate
to silently pass validation of XML files with remotexsi:schemalocations
. For these files, the validator will only test whether the file is well formed.
The xml:transform
goal is bound to the generate-resources
phase, and is used to transform XML documents with a XML Stylesheet Transformer (XSLT). The XSL Transformer supports XSLT 2.0.
Execution with includes
directive.
<plugin>
<groupId>org.openjax.xml</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>0.9.5</version>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<destDir>${project.build.directory}/generated-resources</destDir>
<rename>/\.\S+$/.txt/</rename>
<stylesheet>src/main/resources/stylesheet.xsl</stylesheet>
<includes>
<include>**/*.xml</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Name | Type | Use | Description |
---|---|---|---|
/skip¹ | Boolean | Optional | Skip execution. Default: false . |
/destDir¹ | String | Required | Destination directory of transformed files. |
/rename¹ |
String |
Optional |
Regex pattern to rename input file to output file:/<input>/<output>/ Default: null . |
/includes¹ | List | Optional | List of include directives. Default: null . |
/includes/includeⁿ | String | Optional | Pattern of files to include. Default: null . |
/excludes¹ | List | Optional | List of exclude directives. Default: null . |
/excludes/excludeⁿ | String | Optional | Pattern of files to exclude. Default: null . |
/resources¹ | List | Optional | List of resource names. Default: null . |
/resources/resourceⁿ | String | Optional | Resource name on the classpath. Default: null . |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This project is licensed under the MIT License - see the LICENSE.txt file for details.