Groovy Documentation

org.gradle.plugins.ide.idea.model
[Groovy] Class IdeaProject

java.lang.Object
  org.gradle.plugins.ide.idea.model.IdeaProject

class IdeaProject
extends java.lang.Object

Enables fine-tuning project details (*.ipr file) of the Idea plugin

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'

 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 change the modules of the the *.ipr
     //modules = project(':someProject').idea.module

     //you can change the output file
     outputFile = new File(outputFile.parentFile, 'someBetterName.ipr')
   }
 }
 
For tackling edge cases users can perform advanced configuration on resulting xml file. It is also possible to affect the way idea plugin merges the existing configuration via beforeMerged and whenMerged closures.

beforeMerged and whenMerged closures receive Project object

Examples of advanced configuration:

 apply plugin: 'java'
 apply plugin: '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
       }
     }
   }
 }
 
Authors:
Szczepan Faber, created at: 4/4/11


Property Summary
XmlFileContentMerger ipr

See ipr(Closure)

java.lang.String jdkName

The java version used for defining the project sdk.

IdeaLanguageLevel languageLevel

The java language level of the project.

java.util.List modules

A ConventionProperty that holds modules for the ipr file.

java.io.File outputFile

Output *.ipr

See the examples in the docs for IdeaProject

PathFactory pathFactory

java.util.Set wildcards

The wildcard resource patterns.

 
Constructor Summary
IdeaProject(XmlFileContentMerger ipr)

 
Method Summary
void ipr(groovy.lang.Closure closure)

Enables advanced configuration like tinkering with the output xml or affecting the way existing *.ipr content is merged with gradle build information

See the examples in the docs for IdeaProject

void mergeXmlProject(Project xmlProject)

void setLanguageLevel(java.lang.Object languageLevel)

 
Methods inherited from class java.lang.Object
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#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

ipr

final XmlFileContentMerger ipr
See ipr(Closure)


jdkName

java.lang.String jdkName
The java version used for defining the project sdk.

See the examples in the docs for IdeaProject


languageLevel

IdeaLanguageLevel languageLevel
The java language level of the project. Pass a valid java number, i.e: '1.8' or language level in IDEA's format, i.e: 'JDK_1_5'

See the examples in the docs for IdeaProject


modules

java.util.List modules
A ConventionProperty that holds modules for the ipr file.

See the examples in the docs for IdeaProject


outputFile

java.io.File outputFile
Output *.ipr

See the examples in the docs for IdeaProject


pathFactory

PathFactory pathFactory


wildcards

java.util.Set wildcards
The wildcard resource patterns.

See the examples in the docs for IdeaProject


 
Constructor Detail

IdeaProject

IdeaProject(XmlFileContentMerger ipr)


 
Method Detail

ipr

void ipr(groovy.lang.Closure closure)
Enables advanced configuration like tinkering with the output xml or affecting the way existing *.ipr content is merged with gradle build information

See the examples in the docs for IdeaProject


mergeXmlProject

void mergeXmlProject(Project xmlProject)


setLanguageLevel

void setLanguageLevel(java.lang.Object languageLevel)


 

Groovy Documentation