What is "components.java"


I see “components.java” in the maven-publish plugin documentation. That documentation mentions that components.java is added by the Java plugin. However, the Java plugin documentation doesn’t mention anything about components. Actually I can find very little documentation about components. So what exactly is included in components.java? What is it? Why doesn’t the java plugin doc mention anything about it?

This contains the only documentation for components I can find: https://docs.gradle.org/current/userguide/software_model_extend.html#sec:components

Here is an example of its usage from the maven-publication plugin doc:

  publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java

    repositories {

(Dyno Fu) #2

set a breakpoint on components.java, we can see that it’s

roughly, it’s something like,

components => project.components => DefaultSoftwareComponentContainer
components.java => components.getByName(“java”) => JavaLibraryDecorated …