Idea Project
Enables fine-tuning project details (*.ipr file) of the IDEA plugin.
Example of use with a blend of all possible properties. Typically you don't have to configure IDEA module directly because Gradle configures it for you.
import org.gradle.plugins.ide.idea.model.*
plugins {
id 'java'
id 'idea'
}
idea {
project {
//if you want to set specific jdk and language level
jdkName = '1.6'
languageLevel = '1.5'
//you can update the source wildcards
wildcards += '!?*.ruby'
//you can configure the VCS used by the project
vcs = 'Git'
//you can change the modules of the *.ipr
//modules = project(':some-project').idea.module
//you can change the output file
outputFile = new File(outputFile.parentFile, 'someBetterName.ipr')
//you can add project-level libraries
projectLibraries << new ProjectLibrary(name: "my-library", classes: [new File("path/to/library")])
}
}
Content copied to clipboard
beforeMerged and whenMerged closures receive Project object
Examples of advanced configuration:
plugins {
id 'java'
id 'idea'
}
idea {
project {
ipr {
//you can tinker with the output *.ipr file before it's written out
withXml {
def node = it.asNode()
node.appendNode('iLove', 'tinkering with the output *.ipr file!')
}
//closure executed after *.ipr content is loaded from existing file
//but before gradle build information is merged
beforeMerged { project ->
//you can tinker with Project
}
//closure executed after *.ipr content is loaded from existing file
//and after gradle build information is merged
whenMerged { project ->
//you can tinker with Project
}
}
}
}
Content copied to clipboard