3

When I run my application with external libraries I get the following:

Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules module-a and module-b export package some.package to module module-c

I found similar question, but what should I do if I have external libraries e.g.:

Modules kotest.assertions.jvm and kotest.core.jvm export package io.kotlintest to module slf4j.api

I use jlink in the gradle file.

Repository with the example: https://github.com/Patresss/KotestModule

Patres
  • 147
  • 2
  • 20
  • 2
    you've got to raise it to the library owners to plan to export varied package name or else resolve these jars on classpath instead of modulepath – Naman Jun 07 '20 at 03:24
  • What do you mean by "resolve these jars on classpath". Should I remove the library from the gradle dependency and add it as a jar file? There is no other way? – Patres Jun 07 '20 at 07:48
  • I use module path so I do not want to change it to classpath because of one library – Patres Jun 09 '20 at 16:20
  • 1
    Which two modules are creating the conflict? Your example only declares a single dependency, `requires kotlin.stdlib;` – Holger Jun 10 '20 at 11:44
  • See [Whitebox test execution with module patching](https://docs.gradle.org/current/userguide/java_testing.html#sec:java_testing_modular_patching) – Johannes Kuhn Jun 11 '20 at 02:47
  • @Holger The question is not about a specific module, but in my example, in the repository it is: kotest.assertions.jvm and kotest.assertions.core.jvm – Patres Jun 11 '20 at 08:21
  • 2
    The general approach has been nailed by user Naman in the first comment, tell the module authors to fix the issue. But it’s striking that a) your example does not actually declare to use the specified modules, b) these names do not sound like actual module names, c) these names suggest testing whereas you said “when I *run* my application” at the beginning of the question, and d) the names posted in your last comment do not even match the names posted in the question. – Holger Jun 11 '20 at 09:56
  • What you are asking is contradiction to what module system is for. You have choice not to use module system if you don't want it. – krishna T Feb 04 '21 at 09:18

0 Answers0