kotlin-logging icon indicating copy to clipboard operation
kotlin-logging copied to clipboard

error: module not found: kotlin.logging

Open elect86 opened this issue 5 years ago • 8 comments

These are my dependencies in build.gradle.kts:

    implementation("io.github.microutils:kotlin-logging:1.7.8")
    implementation("org.slf4j:slf4j-api:1.7.29")

Then in module-info.java:

requires kotlin.logging;

All the rest works fine with the Java modular approach

However whenever I try to build, then I get:

> Task :compileJava FAILED
6 actionable tasks: 6 executed
C:\Users\elect\IdeaProjects\assimp\src\main\java\module-info.java:13: error: module not found: kotlin.logging
    requires kotlin.logging;

What am I doing wrong?

elect86 avatar Nov 04 '20 12:11 elect86

Hi, can you try version 2.0.3? Artifact id is kotlin-logging-jvm in 2.0.3.

oshai avatar Nov 04 '20 19:11 oshai

Hi, can you try version 2.0.3? Artifact id is kotlin-logging-jvm in 2.0.3.

Similar

C:\Users\elect\IdeaProjects\assimp\src\main\java\module-info.java:13: error: module not found: kotlin.logging.jvm
    requires kotlin.logging.jvm;

elect86 avatar Nov 04 '20 20:11 elect86

I found a couple of links that might be helpful. IIUC you should treat kotlin logging as an automatic module. See: https://stackoverflow.com/questions/46741907/what-is-an-automatic-module https://stackoverflow.com/questions/46713289/how-to-use-3rd-party-library-in-java9-module https://stackoverflow.com/questions/56797669/javac-returns-error-module-not-found-ini4j

If that still not help, please try to provide a repo to reproduce it and I will inspect it.

oshai avatar Nov 06 '20 02:11 oshai

Yeah, I know

Reference

PS C:\Users\elect> jar --file=C:\Users\elect\.gradle\caches\modules-2\files-2.1\io.github.microutils\kotlin-logging-jvm\2.0.3\acd404001442be5d98fbaa7ff9df83041cba70fe\kotlin-logging-jvm-2.0.3.jar --describe-module
No module descriptor found. Derived automatic module.

[email protected] automatic
requires java.base mandated
contains mu
contains mu.internal

Repo/branch is here

elect86 avatar Nov 06 '20 09:11 elect86

Hi, After some effort I managed to reproduce it. As a side note I must say it's my first encounter with the module systems and it's not a pleasant one. The web is full of those error messages of all sorts and kinds and solutions are not obvious.

I suspect that this is somehow related to the module-path.java. When I moved the file to Kotlin src folder compile was successful. I am not sure if it's the solution or that in such case the file was ignored. I found one answer in stackoverflow that indicates a similar issue and hints --module-path path is not correct.

oshai avatar Nov 17 '20 20:11 oshai

Hi, After some effort I managed to reproduce it. As a side note I must say it's my first encounter with the module systems and it's not a pleasant one. The web is full of those error messages of all sorts and kinds and solutions are not obvious.

I suspect that this is somehow related to the module-path.java. When I moved the file to Kotlin src folder compile was successful. I am not sure if it's the solution or that in such case the file was ignored. I found one answer in stackoverflow that indicates a similar issue and hints --module-path path is not correct.

I might help

Take a look at this lib of our. Every module has its own module-info.java and then you need to patch each module by adding the corresponding kotlin sources like here

elect86 avatar Nov 18 '20 09:11 elect86

I have a couple of questions:

  • The lib is compiled to java 8. Should it work with that?
  • Shouldn't it work out-of-the-box as an automatic module?
  • What will happen to users that don't use the module systems if we'll add it?

oshai avatar Nov 18 '20 10:11 oshai

I have a couple of questions:

* The lib is compiled to java 8. Should it work with that?

No, it won't unfortunately. Only jdk 9+ can recognize that properly

* Shouldn't it work out-of-the-box as an automatic module?

In theory yes, but I guess this works out-of-the-box for java and pretty standard structure projects.

* What will happen to users that don't use the module systems if we'll add it?

I think they won't be affected, but we can give it a try on a separate branch and test it properly before taking some serious/long-term decision

elect86 avatar Nov 18 '20 19:11 elect86

Might be related to #223.

oshai avatar Oct 29 '22 18:10 oshai

Closing this as fixed with #163.

oshai avatar Feb 10 '23 23:02 oshai