GenerateIdeaModule

API Documentation:GenerateIdeaModule

Generates an IDEA module file. If you want to fine tune the idea configuration

Please refer to interesting examples on idea configuration in IdeaModule.

At this moment nearly all configuration is done via IdeaModule.

Properties

PropertyDescription
downloadJavadoc

Deprecated. Please use #idea.module.downloadJavadoc. See examples in IdeaModule.

downloadSources

Deprecated. Please use #idea.module.downloadSources. See examples in IdeaModule.

excludeDirs

Deprecated. Please use #idea.module.excludeDirs. See examples in IdeaModule.

inheritOutputDirs

Deprecated. Please use #idea.module.inheritOutputDirs. See examples in IdeaModule.

inputFile

The input file to load the initial configuration from. Defaults to the output file. If the specified input file does not exist, this task uses some default initial configuration.

javaVersion

Deprecated. Please use #idea.module.jdkName. See examples in IdeaModule.

moduleDir

Deprecated. Please use #idea.module.contentRoot. See examples in IdeaModule.

moduleName

Deprecated. Please use #idea.module.name. See examples in IdeaModule.

outputDir

Deprecated. Please use #idea.module.outputDir. See examples in IdeaModule.

outputFile

Configures output *.iml file. It's optional because the task should configure it correctly for you (including making sure it is unique in the multi-module build). If you really need to change the output file name it is much easier to do it via the idea.module.name property.

scopes

Deprecated. Please use #idea.module.scopes. See examples in IdeaModule.

sourceDirs

Deprecated. Please use #idea.module.sourceDirs. See examples in IdeaModule.

testOutputDir

Deprecated. Please use #idea.module.testOutputDir. See examples in IdeaModule.

testSourceDirs

Deprecated. Please use #idea.module.testSourceDirs. See examples in IdeaModule.

variables

Deprecated. Please use #idea.pathVariables. See examples in IdeaModule.

Property details

boolean downloadJavadoc

Deprecated. Please use #idea.module.downloadJavadoc. See examples in IdeaModule.

Whether to download and add javadoc associated with the dependency jars.

Default with idea plugin:
false

boolean downloadSources

Deprecated. Please use #idea.module.downloadSources. See examples in IdeaModule.

Whether to download and add sources associated with the dependency jars.

Default with idea plugin:
true

Set<File> excludeDirs

Deprecated. Please use #idea.module.excludeDirs. See examples in IdeaModule.

The directories to be excluded.

Default with idea plugin:
[project.buildDir, project.file('.gradle')]

Boolean inheritOutputDirs

Deprecated. Please use #idea.module.inheritOutputDirs. See examples in IdeaModule.

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.

Default with idea plugin:
null
Default with idea and java plugin:
null

File inputFile

The input file to load the initial configuration from. Defaults to the output file. If the specified input file does not exist, this task uses some default initial configuration.

String javaVersion

Deprecated. Please use #idea.module.jdkName. See examples in IdeaModule.

The JDK to use for this module. If null, the value of the existing or default ipr XML (inherited) is used. If it is set to inherited, the project SDK is used. Otherwise the SDK for the corresponding value of java version is used for this module

Default with idea plugin:
'inherited'

File moduleDir

Deprecated. Please use #idea.module.contentRoot. See examples in IdeaModule.

The content root directory of the module.

Default with idea plugin:
project.projectDir

String moduleName

Deprecated. Please use #idea.module.name. See examples in IdeaModule.

Configures module name. It's optional because the task should configure it correctly for you. By default it will try to use the project.name or prefix it with a part of a project.path to make sure the moduleName is unique in the scope of a multi-module build. The 'uniqeness' of a module name is required for correct import into IntelliJ IDEA and the task will make sure the name is unique. See example below...

moduleName is a synthethic property that actually modifies the outputFile property value. This means that you should not configure both moduleName and outputFile at the same time. moduleName is recommended.

However, in case you really need to override the default moduleName this is the way to go:

apply plugin: 'idea'

ideaModule {
  moduleName = 'some-important-project'
}

since 1.0-milestone-2

Default with idea plugin:
${project.name} (sometimes prefixed with parts of ${project.path} to guarantee uniqeness)

File outputDir

Deprecated. Please use #idea.module.outputDir. See examples in IdeaModule.

The output directory for production classes. If null, no entry will be created.

Default with idea plugin:
null
Default with idea and java plugin:
null

File outputFile

Configures output *.iml file. It's optional because the task should configure it correctly for you (including making sure it is unique in the multi-module build). If you really need to change the output file name it is much easier to do it via the idea.module.name property.

Please refer to documentation in IdeaModule name property. In IntelliJ IDEA the module name is the same as the name of the *.iml file.

Default with idea plugin:
${project.projectDir}/${project.name}.iml (sometimes the project.name is prefixed with parts of ${project.path} to guarantee uniqeness). Bear in mind that usually it is easier to use moduleName property instead of outputFile property.

Deprecated. Please use #idea.module.scopes. See examples in IdeaModule.

The keys of this map are the IDEA scopes. Each key points to another map that has two keys, plus and minus. The values of those keys are collections of Configuration objects. The files of the plus configurations are added minus the files from the minus configurations. See example below...

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"
}

ideaModule {
  scopes.PROVIDED.plus += configurations.provided
}
Default with idea plugin:
[:]
Default with idea and java plugin:
  • COMPILE -> project.configurations.compile
  • RUNTIME -> project.configurations.runtime - project.configurations.compile
  • TEST -> project.configurations.testRuntime - project.configurations.runtime

Set<File> sourceDirs

Deprecated. Please use #idea.module.sourceDirs. See examples in IdeaModule.

The directories containing the production sources.

Default with idea plugin:
[]
Default with idea and java plugin:
source dirs from project.sourceSets.main.allSource

File testOutputDir

Deprecated. Please use #idea.module.testOutputDir. See examples in IdeaModule.

The output directory for test classes. If null, no entry will be created.

Default with idea plugin:
null
Default with idea and java plugin:
null

Set<File> testSourceDirs

Deprecated. Please use #idea.module.testSourceDirs. See examples in IdeaModule.

The directories containing the test sources.

Default with idea plugin:
[]
Default with idea and java plugin:
source dirs from project.sourceSets.test.allSource

Map<String, File> variables

Deprecated. Please use #idea.pathVariables. See examples in IdeaModule.

The variables to be used for replacing absolute paths in the iml entries. For example, you might add a GRADLE_USER_HOME variable to point to the Gradle user home dir.

Default with idea plugin:
[:]

Script blocks

No script blocks

Methods

MethodDescription
beforeConfigured(closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

beforeConfigured(action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

whenConfigured(closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

whenConfigured(action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

withXml(closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

withXml(action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Method details

void beforeConfigured(Closure closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds a closure to be called before the domain object is configured by this task. The domain object is passed as a parameter to the closure.

The closure is executed after the domain object has been loaded from the input file. Using this method allows you to change the domain object in some way before the task configures it.

void beforeConfigured(Action<? super T> action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds an action to be called before the domain object is configured by this task. The domain object is passed as a parameter to the action.

The action is executed after the domain object has been loaded from the input file. Using this method allows you to change the domain object in some way before the task configures it.

void whenConfigured(Closure closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds a closure to be called after the domain object has been configured by this task. The domain object is passed as a parameter to the closure.

The closure is executed just before the domain object is written to the output file. Using this method allows you to override the configuration applied by this task.

void whenConfigured(Action<? super T> action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds an action to be called after the domain object has been configured by this task. The domain object is passed as a parameter to the action.

The action is executed just before the domain object is written to the output file. Using this method allows you to override the configuration applied by this task.

void withXml(Closure closure)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds a closure to be called when the XML document has been created. The XML is passed to the closure as a parameter in form of a XmlProvider. The closure can modify the XML before it is written to the output file.

void withXml(Action<? super XmlProvider> action)

Deprecated. Moved to the relevant type. Where? For starters, see examples in IdeaProject or EclipseProject.

Adds an action to be called when the XML document has been created. The XML is passed to the action as a parameter in form of a XmlProvider. The action can modify the XML before it is written to the output file.