api / org.gradle.api.plugins / JavaPluginConvention

JavaPluginConvention

open class JavaPluginConvention

Is mixed into the project when applying the org.gradle.api.plugins.JavaBasePlugin or the org.gradle.api.plugins.JavaPlugin.

Constructors

<init>

JavaPluginConvention(project: ProjectInternal, instantiator: Instantiator)

Functions

getDocsDir

open fun getDocsDir(): File

Returns a file pointing to the root directory supposed to be used for all docs.

getDocsDirName

open fun getDocsDirName(): String

The name of the docs directory. Can be a name or a path relative to the build dir.

getProject

open fun getProject(): ProjectInternal

getSourceCompatibility

open fun getSourceCompatibility(): JavaVersion

Returns the source compatibility used for compiling Java sources.

getSourceSets

open fun getSourceSets(): SourceSetContainer

The source sets container.

getTargetCompatibility

open fun getTargetCompatibility(): JavaVersion

Returns the target compatibility used for compiling Java sources.

getTestReportDir

open fun getTestReportDir(): File

Returns a file pointing to the root directory to be used for reports.

getTestReportDirName

open fun getTestReportDirName(): String

The name of the test reports directory. Can be a name or a path relative to org.gradle.api.reporting.ReportingExtension#getBaseDir.

getTestResultsDir

open fun getTestResultsDir(): File

Returns a file pointing to the root directory of the test results.

getTestResultsDirName

open fun getTestResultsDirName(): String

The name of the test results directory. Can be a name or a path relative to the build dir.

manifest

open fun manifest(): Manifest

Creates a new instance of a Manifest.

open fun manifest(closure: Closure<Any>): Manifest

Creates and configures a new instance of a Manifest. The given closure configures the new manifest instance before it is returned.

open fun manifest(action: Action<in Manifest>): Manifest

Creates and configures a new instance of a Manifest.

setDocsDirName

open fun setDocsDirName(docsDirName: String): Unit

setSourceCompatibility

open fun setSourceCompatibility(value: Any): Unit
open fun setSourceCompatibility(value: JavaVersion): Unit

Sets the source compatibility used for compiling Java sources.

setTargetCompatibility

open fun setTargetCompatibility(value: Any): Unit
open fun setTargetCompatibility(value: JavaVersion): Unit

Sets the target compatibility used for compiling Java sources.

setTestReportDirName

open fun setTestReportDirName(testReportDirName: String): Unit

setTestResultsDirName

open fun setTestResultsDirName(testResultsDirName: String): Unit

sourceSets

open fun sourceSets(closure: Closure<Any>): Any

Configures the source sets of this project.

The given closure is executed to configure the SourceSetContainer. The SourceSetContainer is passed to the closure as its delegate.

See the example below how org.gradle.api.tasks.SourceSet 'main' is accessed and how the org.gradle.api.file.SourceDirectorySet 'java' is configured to exclude some package from compilation.

 apply plugin: 'java' sourceSets { main { java { exclude 'some/unwanted/package/**' } } }