dnault / therapi-runtime-javadoc

Read Javadoc comments at run time.
Apache License 2.0
117 stars 19 forks source link

error: module not found: therapi.runtime.javadoc #51

Closed elect86 closed 2 years ago

elect86 commented 2 years ago

As titled, I'm trying to get therapi-runtime-javadoc working in a Gradle multiproject with JPMS

The problematic module is scijava-discovery-therapi

I added the dependencies as shown on the readme

    // Annotation processor (prior to Gradle 4.6, use `compileOnly` instead)
    annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0")

    // Runtime library
    implementation("com.github.therapi:therapi-runtime-javadoc:0.12.0")

But at sync I keep getting

/home/elect/IdeaProjects/incubator/scijava/scijava-discovery-therapi/src/main/java/module-info.java:8: error: module not found: therapi.runtime.javadoc requires therapi.runtime.javadoc;

The module-info.java is the following

module org.scijava.discovery.therapi {

    exports org.scijava.discovery.therapi;
    opens org.scijava.discovery.therapi to therapi.runtime.javadoc;

    requires org.scijava.discovery;
    requires transitive org.scijava.parse2;
    requires therapi.runtime.javadoc; // this is the problematic line
}

If I click on the therapi.runtime.javadoc I do end up in the right dependency

Screenshot from 2021-11-07 10-27-29

All the Default packages have annotation processing enable as follow

Screenshot from 2021-11-07 10-28-52

While the Gradle imported has a custom one:

Screenshot from 2021-11-07 10-29-46

Which I think is fine, but I still cant understand why it cannot find this module..

dnault commented 2 years ago

Hi Giuseppe,

therapi-runtime-javadoc targets Java 7, and doesn't include any module descriptors, so I'm afraid I don't know where the "therapi.runtime.javadoc" module is supposed to come from. Have you asked the scijava developers?

Thanks, David

elect86 commented 2 years ago

Hello David,

I guess this could/should be the default module name in case there is no module-info.class and isn't targetting jdk9+..

Uhm, I can give it a try and see if with a refresh (latest gradle + kts) this works, also I could provide a PR if you interested

dnault commented 2 years ago

Hello Giuseppe,

Apologies for the late response. Did you figure this out? If a change to the library is required, a PR would indeed be welcome.

Thanks, David

elect86 commented 2 years ago

Hey,

no problems.

At the end it was a limitation/natural behavior due to the JPMS and Gradle interaction

elect86 commented 1 year ago

@dnault

Hello David,

at the end, digging deep, this is how therapi should be use with modules

plugins {
    ..
    id("org.gradlex.extra-java-module-info") version "1.2"
}
extraJavaModuleInfo {
    module("com.github.therapi:therapi-runtime-javadoc-scribe", "therapi.runtime.javadoc.scribe", "0.13.0") {
        exportAllPackages()
    }
    module("com.github.therapi:therapi-runtime-javadoc", "therapi.runtime.javadoc", "0.13.0") {
        exportAllPackages()
    }
}

You may want to add this in the readme