|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectorg.gradle.plugins.ide.idea.model.IdeaModule
class IdeaModule extends java.lang.Object
Model for idea module.
Example of use with a blend of all possible properties. Bear in mind that usually you don't have configure idea module directly because Gradle configures it for free!
apply plugin: 'java' apply plugin: 'idea' //for the sake of the example lets have a 'provided' dependency configuration configurations { provided provided.extendsFrom(compile) } dependencies { //provided "some.interesting:dependency:1.0" } idea { module { //if for some reason you want to add an extra sourceDirs sourceDirs += file('some-extra-source-folder') //and some extra test source dirs testSourceDirs += file('some-extra-test-dir') //and some extra dirs that should be excluded by IDEA excludeDirs += file('some-extra-exclude-dir') //if you don't like the name Gradle have chosen name = 'some-better-name' //if you prefer different output folders inheritOutputDirs = false outputDir = file('muchBetterOutputDir') testOutputDir = file('muchBetterTestOutputDir') //if you prefer different java version than inherited from IDEA project javaVersion = '1.6' //if you need to put provided dependencies on the classpath scopes.COMPILE.plus += configurations.provided //if 'content root' (as IDEA calls it) of the module is different moduleDir = file('my-module-content-root') //TODO SF: contentRoot //if you love browsing javadocs downloadJavadoc = true //and hate reading sources :) downloadSources = false //if you want parts of paths in resulting *.iml to be replaced by variables (files) variables = [GRADLE_HOME: file('~/cool-software/gradle')] //pathVariables //TODO SF: think about moving the pathVariables to the upper level iml { //if you like to keep *.iml in a secret folder generateTo = file('secret-modules-folder') //if you want to mess with the resulting xml in whatever way you fancy withXml { def node = it.asNode() node.appendNode('iLoveGradle', 'true') node.appendNode('butAlso', 'I find increasing pleasure tinkering with output *.iml contents. Yeah!!!') } //beforeMerged and whenMerged closures are the highest voodoo //and probably should be used only to solve tricky edge cases: //closure executed after *.iml content is loaded from existing file //but before gradle build information is merged beforeMerged { module -> //if you want skip merging exclude dirs module.excludeFolders.clear() } //closure executed after *.iml content is loaded from existing file //and after gradle build information is merged whenMerged { module -> //If you really want to update the javaVersion module.javaVersion = '1.6' //but you don't want to do it here... //because you can do it much easier in idea.module configuration! } } } }Author: Szczepan Faber, created at: 3/31/11
Property Summary | |
---|---|
boolean |
downloadJavadoc
Whether to download and add javadoc associated with the dependency jars. |
boolean |
downloadSources
Whether to download and add sources associated with the dependency jars. |
java.util.Set |
excludeDirs
The directories to be excluded. |
IdeaModuleIml |
iml
|
java.lang.Boolean |
inheritOutputDirs
If true, output directories for this module will be located below the output directory for the project; otherwise, they will be set to the directories specified by outputDir and testOutputDir. |
java.lang.String |
javaVersion
The JDK to use for this module. |
java.io.File |
moduleDir
The content root directory of the module. |
java.lang.String |
name
Idea module name; controls the name of the *.iml file For example see docs for IdeaModule |
java.io.File |
outputDir
The output directory for production classes. |
PathFactory |
pathFactory
|
java.lang.Object |
project
|
java.util.Map |
scopes
The keys of this map are the Intellij scopes. |
java.util.Set |
sourceDirs
The directories containing the production sources. |
java.io.File |
testOutputDir
The output directory for test classes. |
java.util.Set |
testSourceDirs
The directories containing the test sources. |
java.util.Map |
variables
The variables to be used for replacing absolute paths in the iml entries. |
Module |
xmlModule
|
Method Summary | |
---|---|
protected void
|
generate()
|
protected Path
|
getContentPath()
|
protected java.util.Set
|
getDependencies()
|
protected java.util.Set
|
getExcludePaths()
|
protected java.io.File
|
getOutputFile()
|
protected Path
|
getOutputPath()
|
protected java.util.Set
|
getSourcePaths()
|
protected Path
|
getTestOutputPath()
|
protected java.util.Set
|
getTestSourcePaths()
|
void
|
iml(groovy.lang.Closure closure)
Enables advanced configuration like tinkering with the output xml or affecting the way existing *.iml content is merged with gradle build information For example see docs for IdeaModule |
protected void
|
mergeXmlModule(Module xmlModule)
|
protected java.lang.Object
|
path(java.io.File dir)
|
protected void
|
setOutputFile(java.io.File newOutputFile)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString() |
Property Detail |
---|
boolean downloadJavadoc
For example see docs for IdeaModule
boolean downloadSources
For example see docs for IdeaModule
java.util.Set excludeDirs
For example see docs for IdeaModule
IdeaModuleIml iml
java.lang.Boolean inheritOutputDirs
For example see docs for IdeaModule
java.lang.String javaVersion
inherited
, the project SDK is used. Otherwise the SDK for the corresponding
value of java version is used for this module
For example see docs for IdeaModule
java.io.File moduleDir
For example see docs for IdeaModule
java.lang.String name
For example see docs for IdeaModule
java.io.File outputDir
For example see docs for IdeaModule
PathFactory pathFactory
java.lang.Object project
java.util.Map scopes
Example how to use scopes property to enable 'provided' dependencies in the output *.iml file:
apply plugin: 'java' apply plugin: 'idea' configurations { provided provided.extendsFrom(compile) } dependencies { //provided "some.interesting:dependency:1.0" } idea { module { scopes.COMPILE.plus += configurations.provided } }
java.util.Set sourceDirs
For example see docs for IdeaModule
java.io.File testOutputDir
For example see docs for IdeaModule
java.util.Set testSourceDirs
For example see docs for IdeaModule
java.util.Map variables
For example see docs for IdeaModule
Module xmlModule
Method Detail |
---|
protected void generate()
protected Path getContentPath()
protected java.util.Set getDependencies()
protected java.util.Set getExcludePaths()
protected java.io.File getOutputFile()
protected Path getOutputPath()
protected java.util.Set getSourcePaths()
protected Path getTestOutputPath()
protected java.util.Set getTestSourcePaths()
void iml(groovy.lang.Closure closure)
For example see docs for IdeaModule
protected void mergeXmlModule(Module xmlModule)
protected java.lang.Object path(java.io.File dir)
protected void setOutputFile(java.io.File newOutputFile)
Groovy Documentation