[英]Write ODF Spreadsheet documents with ODFDOM Java API
I want to update an old program from Java 8 to Java 15 with modules and therefore I rewrite and update a lot of code.我想用模块将旧程序从 Java 8 更新到 Java 15 ,因此我重写和更新了很多代码。 Everything works fine until the update of the library to write spreadsheet documents.
一切正常,直到更新库以编写电子表格文档。
In the old version, I used the org.odftoolkit with the simple-api with maven.在旧版本中,我使用org.odftoolkit和带有 maven 的simple-api 。
<dependency>
<groupId>org.odftoolkit</groupId>
<artifactId>odfdom-java</artifactId>
<version>0.8.7</version>
</dependency>
<dependency>
<groupId>org.odftoolkit</groupId>
<artifactId>simple-java</artifactId>
<version>0.4</version>
</dependency>
As described here , this API is deprecated and I want to step over to the current ODFDOM API.如此处所述,此API 已弃用,我想转至当前的ODFDOM API。 But the documentation is not current with the latest version and I did not found an example for the java module.
但是文档不是最新版本的,我没有找到 java 模块的示例。
I added the maven dependencies, but the question is how to add this to the module-info.java file.我添加了 maven 依赖项,但问题是如何将其添加到 module-info.java 文件中。 All my attempts with
我所有的尝试
requires org.odftoolkit.odfdom.doc.table;
or equal ones have failed miserably.或同等的人惨遭失败。
My question may occur simply, but for me, it is a big mountain.我的问题可能很简单,但对我来说,它是一座大山。 What is the right way to do this?
这样做的正确方法是什么? Thank you for any input.
感谢您的任何意见。
jar --file=/path/to/your/jar/odfdom-java-0.8.7.jar --describe-module
In your case, if these dependencies are not yet modular or declare their Automatic-Module-Name
.在您的情况下,如果这些依赖项尚未模块化或声明它们的
Automatic-Module-Name
。 You can still make use of the derived name in the module directives to make use of the public classes within the packages of the modules.您仍然可以使用模块指令中的派生名称来使用模块包中的公共类。
requires odfdom.java;
requires simple.java;
As the specification of Module declaration guides:作为模块声明指南的规范:
requires {RequiresModifier} ModuleName ;
RequiresModifier:
(one of)
transitive static
you need to specify the module name instead of the packages that your code would rely upon.您需要指定模块名称而不是代码所依赖的包。
Additionally, upon some research, I could find out, that you might want to test the BETA or RC version of the toolkit, as listed in the repository tags and maven central.此外,通过一些研究,我可以发现,您可能想要测试工具包的 BETA 或 RC 版本,如存储库标签和 maven 中心中所列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.