我已将xml-maven-plugin
配置为使用本地定义的XSLT架构运行,以验证项目中定义的所有XSLT文件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<executions>
<execution>
<id>validate-xsl</id>
<goals>
<goal>validate</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<validationSets>
<validationSet>
<dir>${project.build.resources[0].directory}</dir>
<systemId>${project.build.testResources[0].directory}/schema-for-xslt20.xsd</systemId>
<includes>
<include>**/*.xsl</include>
</includes>
</validationSet>
</validationSets>
</configuration>
</plugin>
然而,一旦我拉出网络电缆,它就无法成功运行:
[ERROR] Failed to execute goal org.codehaus.mojo:xml-maven-plugin:1.0-beta-3:validate (default-cli) on project projectdotnet: Failed to load schema with public ID null, system ID /home/robert/..../src/test/resources/schema-for-xslt20.xsd: src-resolve: Cannot resolve the name 'xs:schema' to a(n) 'element declaration' component. -> [Help 1]
我已经读过这可以通过using an XML catalog来解决,但我没有找到任何完整的参考资料来使用该插件。
如何使此验证脱机工作?
答案 0 :(得分:2)
您可以在验证目标属性中指定目录,如下所述: http://mojo.codehaus.org/xml-maven-plugin/validation.html
XML目录是标准的东西,你试过它吗?它不起作用?基本上,您需要将架构(或DTD)命名空间URL映射到本地文件系统中的位置。