For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

from

abstract fun from(component: SoftwareComponent)(source)

Provides the software component that should be published.

  • Any artifacts declared by the component will be included in the publication.
  • The dependencies declared by the component will be included in the published meta-data.
Currently 3 types of component are supported: 'components.java' (added by the JavaPlugin), 'components.web' (added by the WarPlugin) and `components.javaPlatform` (added by the JavaPlatformPlugin). For any individual MavenPublication, only a single component can be provided in this way. The following example demonstrates how to publish the 'java' component to a Maven repository.
plugins {
    id 'java'
    id 'maven-publish'
}

publishing {
  publications {
    maven(MavenPublication) {
      from components.java
    }
  }
}

Since

1.5

Parameters

component

The software component to publish.