[JAVA-2520] Add module-info.java for each module Created: 26/May/17  Updated: 30/Mar/22

Status: Backlog
Project: Java Driver
Component/s: Packaging
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Case:

 Description   

Non-automatic Java 9 modules require a module-info.java file for each module in the root of the source tree.

This is complicated for a library like the Java driver which targets older JREs. From what I can tell looking at other libraries like SLF4J, we'll need to compile all .java files except module-info.java targeting Java 8, and compile module-info.java targeting Java 9.



 Comments   
Comment by Jeffrey Yemin [ 11/Mar/19 ]

It's not the dependency on the JAVA ticket for zstd/snappy, it's the library dependency that we took adding their own module-info.

Comment by Ian Whalen (Inactive) [ 11/Mar/19 ]

K. I see zstd as done (JAVA-3145) but I can't find the snappy ticket anywhere?

Comment by Jeffrey Yemin [ 11/Mar/19 ]

It's more blocked on the zstd and snappy libs at this point. It depends on JAVA-3037.

Comment by Ian Whalen (Inactive) [ 11/Mar/19 ]

jeff.yemin is this now blocked on JAVA-3037?

Comment by Ian Whalen (Inactive) [ 04/Mar/19 ]

Just an update that it looks like slf4j has done this so now we're just blocked on removing netty. might also be blocked on zstd and snappy libs? jeff.yemin to confirm.

Comment by Christoph Strobl [ 14/Jan/19 ]

Support for using just mongodb-driver-core & mongodb-driver-sync along with Spring Data MongoDB requires some breaking changes in Spring Datas public API.
Without the mongo-java-driver there are issues with Bean introspection and missing types beeing used in parts of the code where one might still use DBObject.
For the Moore Release we will stick to the uber jar and planned to support a mongodb-driver-sync only scenario in the subsequent release train.
If you want to follow progress on that issue please watch DATAMONGO-2176.

Comment by Jeffrey Yemin [ 13/Jan/19 ]

HI muratozkan,

Yes we've made progress.  See http://mongodb.github.io/mongo-java-driver/3.9/driver/getting-started/installation/ for the automatic module names we've declared.  The problem is that, due to some package decisions that were made early on in the driver, there are some jar file combinations where the same package exists in both jar files: in particular mongodb-driver and mongodb-driver-core. 

Since the 3.7 release, we have given users an option that avoid that problem: the mongodb-driver-sync jar file, whose automatic module name is org.mongodb.driver.sync.client. 

At this point, I'm not sure if there is a way to get this working with Spring, as I don't know exactly what it depends on.

cstrobl, do you have anything you can add here?

 

In regard to actually adding module-info.java files, we don't intend to do that until all of our dependencies do: in particular, SLF4J, Netty, and snappy-java have not declare their module names yet.

 

Comment by Murat Ozkan [ 13/Jan/19 ]

Hi,

Is there any progress on this issue? Currently, we cannot use jlink in our project with SpringBoot 2.1.2.RELEASE which has the following dependencies (skipping irrelevant ones):

  • org.springframework.boot:spring-boot-starter-data-mongodb-reactive:2.1.2.RELEASE
    • org.springframework.data:spring-data-mongodb:2.1.4.RELEASE
      • org.mongodb:mongodb-driver:3.8.2
        • org.mongodb:mongodb-driver-core:3.8.2
      • org.mongodb:mongodb-driver-async:3.8.2
      • org.mongodb:mongodb-driver-reactivestreams:3.8.2

The problem with jlink is this:

Error: Modules org.mongodb.driver.core and mongodb.driver export package com.mongodb to module xxxxx

There's no module-info.java in any mongodb jars, then automodule generation kicks in. That also fails because the package names in mongodb-driver and mongodb-driver-core are the same. 

Since there's automodules, we don't have to wait until every other dependency has a module-info.java file.

Cheers,

Murat

 

Comment by Jeffrey Yemin [ 14/Dec/17 ]

Currently blocked waiting for downstream dependencies SLF4J and Netty to commit to module names.

Comment by Jeffrey Yemin [ 04/Dec/17 ]

IntelliJ is also going to be a problem because module syntax is only allowed when the language level is set to Java 9, which we don't want to for anything else in order to support running on older JDKs.

Generated at Thu Feb 08 08:57:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.