Immutables Criteria Syntax Error In JDK 11 Module

143 Views Asked by At

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

There are 1 best solutions below

0
On BEST ANSWER

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.