brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
20.01k stars 2.93k forks source link

update module-info to mark optional dependencies as 'static' #1582

Open prashantbhat opened 4 years ago

prashantbhat commented 4 years ago

After updating to the release version 3.4.5, I get the following error. (using Java 11)

Error occurred during initialization of boot layer java.lang.module.FindException: Module metrics.healthchecks not found, required by com.zaxxer.hikari

The module-info (release 3.4.5) defines following dependencies with requires directive:

requires hibernate.core;
requires javassist;
requires simpleclient;
requires metrics.core;
requires metrics.healthchecks;
requires micrometer.core;

For HikariCP, these dependencies are optional, as in the pom.xml.

Adding the static modifier makes them optional, as defined in java.lang.module package summary

'requires' directives that have the 'static' modifier express an optional dependence at run time

So, it will be very useful if these dependencies are changed to be static. Thanks.

smironov commented 4 years ago

Same issue on Java 14, using HikariCP 3.4.5

brettwooldridge commented 4 years ago

@prashantbhat @smironov Can one of you send a pull request?

prashantbhat commented 4 years ago

Opened PR #1587 with an update to latest Slf4J to use it's correct module name. Please review.

guyv commented 4 years ago

@brettwooldridge any chance of getting this merged and released?

Frank-CG commented 4 years ago

Is there any workaround for this error?

Borwe commented 3 years ago

It's December, and still no one is close?

FanJups commented 3 years ago

@prashantbhat Thanks for the update but I still has the same error

I work on a project using JAVA 11, MAVEN and JAVAFX13.

module-info.java looks like :

module com.mautourco.finance {
    requires javafx.controls;
    requires javafx.fxml;
    requires java.sql;
    requires javafx.base;
    requires javafx.graphics;
    requires com.zaxxer.hikari;

    opens com.mautourco.finance to javafx.fxml;
    opens com.mautourco.finance.controller to javafx.fxml;
    opens com.mautourco.finance.model to javafx.base;

    exports com.mautourco.finance;
}

I tried to add requires com.zaxxer.hikari.metrics but I got this : com.zaxxer.hikari.metrics cannot be resolved to a module

Please, any idea ?

FanJups commented 3 years ago

Downgrading to 2.4.7 works for me

        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>2.4.7</version>

        </dependency>
module com.mautourco.finance {
    requires javafx.controls;
    requires javafx.fxml;
    requires java.sql;
    requires javafx.base;
    requires javafx.graphics;

    requires HikariCP;

    opens com.mautourco.finance to javafx.fxml;
    opens com.mautourco.finance.controller to javafx.fxml;
    opens com.mautourco.finance.model to javafx.base;

    exports com.mautourco.finance;
}
jngrx commented 3 years ago

Hello ! I'm facing the same issue during Java 11+ migration My projet is a Springboot 2.3.5 project with HikariCP 3.4.5 as dependency. I see that this issue is known and a fix has been set up.

@brettwooldridge Any idea why a new release is not done with this fix ? No release since may 2020... Please help !

Thanks, JN Grx