# JavaPluginExtension

interface JavaPluginExtension(source)

Common configuration for JVM (Java) based projects. This extension is added by the JavaBasePlugin and would be more appropriately named the `JvmPluginExtension` extension. It is used to configure many of the project's JVM-related settings and behavior.

#### Since

4.10

## Functions

consistentResolution
Link copied to clipboard
@Incubating
abstract fun consistentResolution(action: Action<in JavaResolutionConsistency>)
Configure the dependency resolution consistency for this Java project.
disableAutoTargetJvm
Link copied to clipboard
abstract fun disableAutoTargetJvm()
If this method is called, Gradle will not automatically try to fetch dependencies which have a JVM version compatible with the target compatibility of this module.
getAutoTargetJvmDisabled
Link copied to clipboard
abstract fun getAutoTargetJvmDisabled(): Boolean
Tells if automatic JVM targeting is enabled.
getDocsDir
Link copied to clipboard
abstract fun getDocsDir(): DirectoryProperty
Returns a file pointing to the root directory supposed to be used for all docs.
getModularity
Link copied to clipboard
abstract fun getModularity(): ModularitySpec
Configure the module path handling for tasks that have a 'classpath' as input.
getSourceCompatibility
Link copied to clipboard
abstract fun getSourceCompatibility(): JavaVersion
Returns the source compatibility used for compiling Java sources.
getSourceSets
Link copied to clipboard
abstract fun getSourceSets(): SourceSetContainer
The source sets container.
getTargetCompatibility
Link copied to clipboard
abstract fun getTargetCompatibility(): JavaVersion
Returns the target compatibility used for compiling Java sources.
getTestReportDir
Link copied to clipboard
abstract fun getTestReportDir(): DirectoryProperty
Returns a file pointing to the root directory to be used for reports.
getTestResultsDir
Link copied to clipboard
abstract fun getTestResultsDir(): DirectoryProperty
Returns a file pointing to the root directory of the test results.
getToolchain
Link copied to clipboard
abstract fun getToolchain(): JavaToolchainSpec
Gets the project wide toolchain requirements that will be used for tasks requiring a tool from the toolchain (e.g.
manifest
Link copied to clipboard
abstract fun manifest(): Manifest
Creates a new instance of a Manifest.
abstract fun manifest(@DelegatesTo(value = Manifest::class) closure: Closure): Manifest
abstract fun manifest(action: Action<in Manifest>): Manifest
Creates and configures a new instance of a Manifest.
registerFeature
Link copied to clipboard
abstract fun registerFeature(name: String, configureAction: Action<in FeatureSpec>)
Registers a feature.
setSourceCompatibility
Link copied to clipboard
abstract fun setSourceCompatibility(value: Any)
abstract fun setSourceCompatibility(value: JavaVersion)
Sets the source compatibility used for compiling Java sources.
setTargetCompatibility
Link copied to clipboard
abstract fun setTargetCompatibility(value: Any)
abstract fun setTargetCompatibility(value: JavaVersion)
Sets the target compatibility used for compiling Java sources.
sourceSets
Link copied to clipboard
abstract fun sourceSets(closure: Closure): Any
@Incubating
abstract fun sourceSets(action: Action<in SourceSetContainer>)
Configures the source sets of this project.
toolchain
Link copied to clipboard
abstract fun toolchain(action: Action<in JavaToolchainSpec>): JavaToolchainSpec
Configures the project wide toolchain requirements for tasks that require a tool from the toolchain (e.g.
withJavadocJar
Link copied to clipboard
abstract fun withJavadocJar()
Enables generating a Javadoc artifact for the main feature of this project.
withSourcesJar
Link copied to clipboard
abstract fun withSourcesJar()
Enables generating a sources artifact for the main feature of this project.