运行 XSpec 与 Maven 和 Saxon-PE7
Running XSpec with Maven and Saxon-PE7
我们要运行XSpec as part of our Maven builds to check our XSL transformations. A plugin is available from GitHub。当我们检查调用函数的 XSL 样式表在 Saxon-HE 中不可用时,问题就出现了,如下所示:
Error at xsl:if on line 194 column 75 of dyxml_table_cals.xsl:
XPST0017 XPath syntax error at char 0 on line 194 near {...table-enumeration-condition...}:
Cannot find a matching 2-argument function named {http://saxon.sf.net/}evaluate().
Saxon extension functions are not available under Saxon-HE
我们拥有 PE 的许可证。 According to the Saxon documentation the enhanced editions revert back to the open source HE when no license information is available, which seems to be the case. Is it possible to activate the PE by way of Maven, e.g. using the plugin by codehaus,那会是什么样子?我们已经使用了一种通过 Java 激活的方法,但如果可能的话,了解另一种可以说更优雅的方法会有所帮助。
我不太熟悉 XSpec 的 Maven 插件,但我尝试提供一些提示和解决方法。
您提到的 Maven 插件的 pom.xml 包含对所用 Saxon 版本的依赖:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.7.0-1</version>
</dependency>
您应该指定 Saxon 版本才能使用 Saxon-PE 或 Saxon-EE。但是,这些 Saxon 版本似乎在 public Maven 存储库中不可用,因为与 Saxon-HE 不同,它们是专有软件。我想您可以将 Saxon-PE 的 .jar 文件放在本地存储库中(有关此内容,请参阅 Maven 文档)。我建议将 .lic 许可证文件放在与 .jar 文件相同的目录中。
可以帮助您找到解决方法的其他两个提示:
- XSpec 允许在 shell 或批处理脚本中的环境变量中指定 Saxon 版本。然后,您可以使用例如 exec-maven-plugin 在您的 Maven 项目中 运行 一个 shell 脚本。这并不理想,但对于您的用例来说可能已经足够了。
- 运行ning XSpec 有 another Maven plugin,您可能也想检查一下。
希望对您有所帮助...
经过反复试验,我们发现以下解决方案有效:
上面链接的 XSpec-Maven-Plugin 的创建者对未经许可的 Saxon-HE 的使用进行了硬编码。特别是,以下行引起了问题:
private final static Processor processor = new Processor(false);
我们分叉代码并将其更改为:
private final static Processor processor = new Processor(true);
我们构建了一个自定义的class来激活许可证并将其集成到插件源代码中。 (不能post这里的代码。)
这解决了许可问题。现在我们的 XSpec 测试已经完成 运行。是的我们!
我们要运行XSpec as part of our Maven builds to check our XSL transformations. A plugin is available from GitHub。当我们检查调用函数的 XSL 样式表在 Saxon-HE 中不可用时,问题就出现了,如下所示:
Error at xsl:if on line 194 column 75 of dyxml_table_cals.xsl:
XPST0017 XPath syntax error at char 0 on line 194 near {...table-enumeration-condition...}:
Cannot find a matching 2-argument function named {http://saxon.sf.net/}evaluate().
Saxon extension functions are not available under Saxon-HE
我们拥有 PE 的许可证。 According to the Saxon documentation the enhanced editions revert back to the open source HE when no license information is available, which seems to be the case. Is it possible to activate the PE by way of Maven, e.g. using the plugin by codehaus,那会是什么样子?我们已经使用了一种通过 Java 激活的方法,但如果可能的话,了解另一种可以说更优雅的方法会有所帮助。
我不太熟悉 XSpec 的 Maven 插件,但我尝试提供一些提示和解决方法。
您提到的 Maven 插件的 pom.xml 包含对所用 Saxon 版本的依赖:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.7.0-1</version>
</dependency>
您应该指定 Saxon 版本才能使用 Saxon-PE 或 Saxon-EE。但是,这些 Saxon 版本似乎在 public Maven 存储库中不可用,因为与 Saxon-HE 不同,它们是专有软件。我想您可以将 Saxon-PE 的 .jar 文件放在本地存储库中(有关此内容,请参阅 Maven 文档)。我建议将 .lic 许可证文件放在与 .jar 文件相同的目录中。
可以帮助您找到解决方法的其他两个提示:
- XSpec 允许在 shell 或批处理脚本中的环境变量中指定 Saxon 版本。然后,您可以使用例如 exec-maven-plugin 在您的 Maven 项目中 运行 一个 shell 脚本。这并不理想,但对于您的用例来说可能已经足够了。
- 运行ning XSpec 有 another Maven plugin,您可能也想检查一下。
希望对您有所帮助...
经过反复试验,我们发现以下解决方案有效:
上面链接的 XSpec-Maven-Plugin 的创建者对未经许可的 Saxon-HE 的使用进行了硬编码。特别是,以下行引起了问题:
private final static Processor processor = new Processor(false);
我们分叉代码并将其更改为:
private final static Processor processor = new Processor(true);
我们构建了一个自定义的class来激活许可证并将其集成到插件源代码中。 (不能post这里的代码。)
这解决了许可问题。现在我们的 XSpec 测试已经完成 运行。是的我们!