# IdeaModule

API Documentation: | `IdeaModule`

Generates an IDEA module file.

### Properties

Property | Description
`downloadJavadoc` | Whether to download and add javadoc associated with the dependency jars.
`downloadSources` | Whether to download and add sources associated with the dependency jars.
`excludeDirs` | The directories to be excluded.
`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 <UNHANDLED-LINK>#outputDir</UNHANDLED-LINK> and <UNHANDLED-LINK>#testOutputDir</UNHANDLED-LINK>.
`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` | 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
`moduleDir` | The content root directory of the module.
`outputDir` | The output directory for production classes. If `null`, no entry will be created.
`outputFile` | The output file to write the final configuration to.
`scopes` | The keys of this map are the Intellij scopes. Each key points to another map that has two keys, plus and minus. The values of those keys are sets of `Configuration` objects. The files of the plus configurations are added minus the files from the minus configurations.
`sourceDirs` | The directories containing the production sources.
`testOutputDir` | The output directory for test classes. If `null`, no entry will be created.
`testSourceDirs` | The directories containing the test sources.
`variables` | 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.

### Property details

#### `boolean` `downloadJavadoc`

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

Default with `idea` plugin:
  `false`

#### `boolean` `downloadSources`

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

Default with `idea` plugin:
  `true`

#### ``Set`<`File`>` `excludeDirs`

The directories to be excluded.

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

#### `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 <UNHANDLED-LINK>#outputDir</UNHANDLED-LINK> and <UNHANDLED-LINK>#testOutputDir</UNHANDLED-LINK>.

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`

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`

The content root directory of the module.

Default with `idea` plugin:
  `project.projectDir`

#### `File` `outputDir`

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`

The output file to write the final configuration to.

Default with `idea` plugin:
  ``${project.projectDir}`/`${project.name}`.iml`

#### ``Map`<`String`, `Map`<`String`, `Configuration`>>` `scopes`

The keys of this map are the Intellij scopes. Each key points to another map that has two keys, plus and minus. The values of those keys are sets of `Configuration` objects. The files of the plus configurations are added minus the files from the minus configurations.

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`

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`

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`

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`

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

Method | Description
`beforeConfigured(closure)` | 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.
`beforeConfigured(action)` | 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.
`whenConfigured(closure)` | 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.
`whenConfigured(action)` | 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.
`withXml(closure)` | 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.
`withXml(action)` | 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.

### Method details

#### `void` `beforeConfigured`(`Closure` closure)

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)

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)

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)

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)

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)

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.