Groovy Documentation

org.gradle.api.plugins
[Groovy] Class JavaPluginConvention

java.lang.Object
  org.gradle.api.plugins.JavaPluginConvention

class JavaPluginConvention
extends java.lang.Object

Is mixed in into the project when applying the JavaBasePlugin or the JavaPlugin.

Authors:
Hans Dockter


Property Summary
java.lang.String dependencyCacheDirName

java.lang.String docsDirName

The name of the docs directory.

org.gradle.api.java.archives.internal.DefaultManifest manifest

java.util.List metaInf

org.gradle.api.internal.project.ProjectInternal project

SourceSetContainer sourceSets

The source sets container.

java.lang.String testReportDirName

The name of the test reports directory.

java.lang.String testResultsDirName

The name of the test results directory.

 
Constructor Summary
JavaPluginConvention(Project project)

 
Method Summary
java.io.File getDependencyCacheDir()

java.io.File getDocsDir()

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

JavaVersion getSourceCompatibility()

Returns the source compatibility used for compiling Java sources.

JavaVersion getTargetCompatibility()

Returns the target compatibility used for compiling Java sources.

java.io.File getTestReportDir()

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

java.io.File getTestResultsDir()

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

Manifest manifest()

Creates a new instance of a Manifest.

Manifest manifest(groovy.lang.Closure closure)

Creates and configures a new instance of a Manifest.

void setSourceCompatibility(java.lang.Object value)

Sets the source compatibility used for compiling Java sources.

void setTargetCompatibility(java.lang.Object value)

Sets the target compatibility used for compiling Java sources.

java.lang.Object sourceSets(groovy.lang.Closure closure)

Configures the source sets of this project.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

dependencyCacheDirName

java.lang.String dependencyCacheDirName


docsDirName

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


manifest

@Deprecated
org.gradle.api.java.archives.internal.DefaultManifest manifest


metaInf

@Deprecated
java.util.List metaInf


project

org.gradle.api.internal.project.ProjectInternal project


sourceSets

final SourceSetContainer sourceSets
The source sets container.


testReportDirName

java.lang.String testReportDirName
The name of the test reports directory. Can be a name or a path relative to the build dir.


testResultsDirName

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


 
Constructor Detail

JavaPluginConvention

JavaPluginConvention(Project project)


 
Method Detail

getDependencyCacheDir

java.io.File getDependencyCacheDir()


getDocsDir

java.io.File getDocsDir()
Returns a file pointing to the root directory supposed to be used for all docs.


getSourceCompatibility

JavaVersion getSourceCompatibility()
Returns the source compatibility used for compiling Java sources.


getTargetCompatibility

JavaVersion getTargetCompatibility()
Returns the target compatibility used for compiling Java sources.


getTestReportDir

java.io.File getTestReportDir()
Returns a file pointing to the root directory to be used for reports.


getTestResultsDir

java.io.File getTestResultsDir()
Returns a file pointing to the root directory of the test results.


manifest

Manifest manifest()
Creates a new instance of a Manifest.


manifest

Manifest manifest(groovy.lang.Closure closure)
Creates and configures a new instance of a Manifest. The given closure configures the new manifest instance before it is returned.
Parameters:
closure - The closure to use to configure the manifest.


setSourceCompatibility

void setSourceCompatibility(java.lang.Object value)
Sets the source compatibility used for compiling Java sources.
value:
The value for the source compatibility as defined by JavaVersion.toVersion


setTargetCompatibility

void setTargetCompatibility(java.lang.Object value)
Sets the target compatibility used for compiling Java sources.
value:
The value for the target compatibilty as defined by JavaVersion.toVersion


sourceSets

java.lang.Object sourceSets(groovy.lang.Closure closure)
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 SourceSet 'main' is accessed and how the SourceDirectorySet 'java' is configured to exclude some package from compilation.

 apply plugin: 'java'

 sourceSets {
   main {
     java {
       exclude 'some/unwanted/package/**'
     }
   }
 }
 
Parameters:
closure - The closure to execute.


 

Groovy Documentation