gradlex-org / extra-java-module-info

A Gradle 6.8+ plugin to use legacy Java libraries as Java Modules in a modular Java project
Apache License 2.0
103 stars 6 forks source link

How to use with Lombok? #51

Closed dtrunk90 closed 1 year ago

dtrunk90 commented 1 year ago

I'm currently trying to add a module-info.java file into my project but :delombok fails because it cannot find a module i've defined actually:

extraJavaModuleInfo {
    module(libs.icu4j, 'com.ibm.icu') {
        exports 'com.ibm.icu.text'
    }
}

java {
    registerFeature('transliterator') {
        usingSourceSet sourceSets.main
    }
}

dependencies {
    transliteratorImplementation libs.icu4j
    testImplementation libs.icu4j
    testImplementation libs.junit
}
module example {
    requires static com.ibm.icu;
    requires static lombok;

    exports com.acme.example;
}
> Task :clean
> Task :processResources
> Task :sourcesJar
> Task :processTestResources NO-SOURCE
> Task :processJmhResources NO-SOURCE
> Task :generateEffectiveLombokConfig
> Task :compileJava
> Task :classes
> Task :jar

> Task :delombok
/home/danny/workspace/test/src/main/java/module-info.java:2: error: module not found: com.ibm.icu
    requires static com.ibm.icu;
                           ^
/home/danny/workspace/test/src/main/java/com/acme/example/Example.java:3: error: package com.ibm.icu.text is not visible
import com.ibm.icu.text.Transliterator;
                  ^
  (package com.ibm.icu.text is declared in the unnamed module, but module com.ibm.icu.text does not read it)

> Task :javadoc

> Task :javadocJar
> Task :assemble
> Task :generateTestEffectiveLombokConfig
> Task :compileTestJava
> Task :testClasses

> Task :test
> Task :generateJmhEffectiveLombokConfig
> Task :compileJmhJava
> Task :jmhClasses
> Task :pmdMain
> Task :checkstyleMain
> Task :pmdTest
> Task :checkstyleTest
> Task :checkstyleJmh
> Task :pmdJmh
> Task :check
> Task :build

BUILD SUCCESSFUL in 13s
20 actionable tasks: 20 executed
6:05:05 PM: Execution finished 'clean build'.
dtrunk90 commented 1 year ago

Just realized it has nothing to do with this plugin. The icu4j lib has an Automatic-Module-Name attribute and should work without this plugin. It's rather related to the lombok gradle plugin.