Search code examples
javagradlepicocli

Why isn't Gradle using the module-info.class of an MRJAR?


I am currently using picocli to create a command-line application. However, Gradle refuses to build it with the following error message.

{project path}\src\main\java\module-info.java:2: error: module not found: info.picocli
    requires info.picocli;

Here's my Gradle dependencies:

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'

    implementation 'info.picocli:picocli:4.6.1'
}

Picocli is hosted as an MRJAR with a module-info.class under META-INF\versions\9, but it seems that Gradle isn't using the file. Why is this?


Solution

  • Looking at this answer, you may need to set the inferModulePath property on the project Java plugin.