Will `java-library` get support for declaring API packages?


(Ned Twigg) #1

The separation between api and implementation jars in the java-library plugin in Gradle 3.4 is a huge accomplishment, thanks very much!!

The next big step for the java module system is declaring which packages of a library are api.

At the moment, it seems that this functionality is not present in java-library (all packages are treated as API), but it is present in the jvm-component / java-lang plugins (docs).

model {
    components {
        main(JvmLibrarySpec) {
            api {
                exports 'org.gradle'
                exports 'org.gradle.utils'
            }
        }
    }
}

What is the roadmap for the java-library plugin? Will it get a mechanism to allow specifying which packages are API? Or will we have to migrate to the jvm-component stuff to get this functionality?

If you’re still deciding, are there any public roadmaps I can follow to see which way it ends up going?

Thanks!


(Stefan Oehme) #2

Yes, it will, most likely in Q2 :slight_smile: