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.

getModuleVersion

@Nullable
abstract fun getModuleVersion(): @Nullable ModuleVersionIdentifier(source)

Returns the module version which this component belongs to, if any. A component will belong to a module version if it was found in some repository, or if the module version for the component has been declared, usually by declaring how the component should be published.

Return

the module version of the component, or null if this component has no associated module version.

Since

1.10