英文:
Immutables Criteria Syntax Error In JDK 11 Module
问题
我有一个项目,想要尝试使用Immutables Criteria: https://immutables.github.io/criteria.html
我在我的pom.xml中添加了以下内容:
<dependency>
<groupId>org.immutables</groupId>
<artifactId>criteria-inmemory</artifactId>
<version>2.8.2</version>
</dependency>
一切似乎都很正常。然而,我在导入和使用时遇到了一些问题。对于Immutables.Value,我没有任何问题,一切都正常。当我导入Criteria时,Eclipse会报告以下问题:
“类型org.immutables.criteria.Criteria不可访问”
因此,我尝试在我的module-info.java中添加模块,如下所示:
requires org.immutables.criteria-common;
也尝试过:
requires org.immutables.criteria-inmemory;
我正在使用Eclipse的建议来自动完成模块名称,因为我不太清楚模块名称应该是什么,但是当我添加上述内容时,Eclipse会说requires语句中的“-”有语法错误。所以在这一点上,我有点困惑!如果有人有任何建议,我会很乐意听取!
谢谢!!
英文:
I have a project that I'm trying to play around with the Immutables Criteria: https://immutables.github.io/criteria.html
I added the following to my pom.xml:
<dependency>
<groupId>org.immutables</groupId>
<artifactId>criteria-inmemory</artifactId>
<version>2.8.2</version>
</dependency>
Everything seemed fine. However, I am having some issues getting things imported and working. I have no issues with Immutables.Value that works fine. When I import Criteria Eclipse complains about:
The type org.immutables.criteria.Criteria is not accessible
So I tried adding the module to my module-info.java as follows:
requires org.immutables.criteria-common;
Also tried:
requires org.immutables.criteria-inmemory;
I'm using Eclipse suggestions to auto-complete the module name because I don't really know what the module name should be but, when I add the above Eclipse says there is a syntax error with the "-" in the requires statement. So at this point I am kinda stuck! If anyone has any suggestions I would love to hear them!
Thanks!!
答案1
得分: 1
我已经能够跟踪到Immutables库的问题,并发布了以下问题链接:https://github.com/immutables/immutables/issues/1223
基本上,该库在构建jar文件时在其pom.xml中创建了一个无效的Automatic-Module-Name标签。设置的值包含了一个无效的“-”。
向@Naman致以感谢,他指导我朝正确的方向前进!谢谢!
我仍然在想是否可以覆盖jar文件的模块名称。似乎允许库的用户在像这样的情况下覆盖库的jar文件模块名称可能会很有用。
英文:
I was able to track down the issue with the Immutables Library and I posted the following issue: https://github.com/immutables/immutables/issues/1223
Basically, the library was creating an invalid Automatic-Module-Name tag in there pom.xml's when building the jar files. The values that we being set contained a "-" which is invalid.
Shoutout to @Naman for pointing me in the right direction! Thanks!
I am still wondering if it is possible to override the jar files module-name. It seems like it could be useful for users of a library to somehow override a libraries jar files module-name for situations like this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论