xml-maven-plugin
xml-maven-plugin copied to clipboard
Caching retrieved DTD or XSD schemas
We are using this plugin to validate a bunch of XML files (1200+ files) whenever changes are made. We have recently had a networking issue that caused a 30 second delay in all network requests. That is not really related to this issue, but it did highlight some unwanted behavior for us as the execution time suddenly surged from a couple of seconds to more than 3 hours.
Every time the plugin has to resolve a schema from an URL, it retrieves this schema file from the network. Unless I am completely overlooking something, it doesn't seem like there is a way to tell the plugin to then cache those schema files for subsequent use within the same run. Because of this, network requests are made multiple times for the same files. When the URL for a file is the same, generally this file will also remain the same.
We've now configured catalog files for these external files and we could probably also configure a proxy to perform caching for these external resources. But ideally, an option for such caching would be available within the plugin to prevent these useless network calls. It shouldn't be enabled by default, unless it is seen as a changed behavior in a major release. Caching will really speed up the validations by a lot as well. I think that honoring the HTTP caching directives isn't really important for this purpose, but I guess it could make sense to do so. An override for this would be welcome in that case, though.