Class IdeaProject
- All Implemented Interfaces:
- Describable,- IdeWorkspace
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")])
   }
 }
 
 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:
 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
       }
     }
   }
 }
 - 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns the display name of this object.getIpr()Seeipr(Action)The java version used for defining the project sdk.The default Java language Level to use for this project.Returns the location of the generated workspace.Modules for the ipr file.getName()The name of the IDEA project.Output *.iprAn owner of this IDEA project.The project-level libraries to be added to the IDEA project.The target bytecode version to use for this project.getVcs()The vcs for the project.The wildcard resource patterns.voidEnables advanced configuration like tinkering with the output XML or affecting the way existing *.ipr content is merged with Gradle build information.voidipr(Action<? super XmlFileContentMerger> action) Enables advanced configuration like tinkering with the output XML or affecting the way existing *.ipr content is merged with Gradle build information.voidmergeXmlProject(Project xmlProject) voidsetJdkName(String jdkName) voidsetLanguageLevel(Object languageLevel) Sets the java language level for the project.voidsetLanguageLevel(IdeaLanguageLevel languageLevel) Sets the java language level for the project.voidsetModules(List<IdeaModule> modules) voidsetOutputFile(File outputFile) voidsetPathFactory(PathFactory pathFactory) voidsetProjectLibraries(Set<ProjectLibrary> projectLibraries) voidsetTargetBytecodeVersion(JavaVersion targetBytecodeVersion) voidvoidsetWildcards(Set<String> wildcards) 
- 
Field Details- 
languageLevel
- 
targetBytecodeVersion
 
- 
- 
Constructor Details- 
IdeaProject
 
- 
- 
Method Details- 
getDisplayNameDescription copied from interface:DescribableReturns the display name of this object. It is strongly encouraged to compute it lazily, and cache the value if it is expensive.- Specified by:
- getDisplayNamein interface- Describable
- Returns:
- the display name
 
- 
getLocationDescription copied from interface:IdeWorkspaceReturns the location of the generated workspace.- Specified by:
- getLocationin interface- IdeWorkspace
 
- 
getProjectAn owner of this IDEA project.If IdeaProject requires some information from gradle this field should not be used for this purpose. 
- 
getIprSeeipr(Action)
- 
iprEnables 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
- 
iprEnables 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- Since:
- 3.5
 
- 
getNameThe name of the IDEA project. It is a convenience property that returns the name of the output file (without the file extension). In IDEA, the project name is driven by the name of the 'ipr' file.
- 
getModulesModules for the ipr file.See the examples in the docs for IdeaProject
- 
setModules
- 
getJdkNameThe java version used for defining the project sdk.See the examples in the docs for IdeaProject
- 
setJdkName
- 
getLanguageLevelThe default Java language Level to use for this project.Generally, it isn't recommended to change this value. Instead, you are encouraged to set sourceCompatibilityandtargetCompatibilityfor your Gradle projects which allows you to have full control over language levels in Gradle projects, and means that Gradle and IDEA will use the same settings when compiling.When not explicitly set, this is calculated as the maximum language level for the Idea modules of this Idea project. 
- 
setLanguageLevelSets the java language level for the project.When explicitly set in the build script, this setting overrides any calculated values for Idea project and Idea module. - Since:
- 4.0
 
- 
setLanguageLevelSets the java language level for the project. Pass a valid Java version number (e.g. '1.5') or IDEA language level (e.g. 'JDK_1_5').See the examples in the docs for IdeaProject.When explicitly set in the build script, this setting overrides any calculated values for Idea project and Idea module. 
- 
getTargetBytecodeVersionThe target bytecode version to use for this project.Generally, it isn't recommended to change this value. Instead, you are encouraged to set sourceCompatibilityandtargetCompatibilityfor your Gradle projects which allows you to have full control over language levels in Gradle projects, and means that Gradle and IDEA will use the same settings when compiling.When languageLevelis not explicitly set, this is calculated as the maximum target bytecode version for the Idea modules of this Idea project.
- 
setTargetBytecodeVersion
- 
getVcsThe vcs for the project.Values are the same as used in IDEA's "Version Control" preference window (e.g. 'Git', 'Subversion'). See the examples in the docs for IdeaProject.
- 
setVcs
- 
getWildcardsThe wildcard resource patterns.See the examples in the docs for IdeaProject.
- 
setWildcards
- 
getOutputFileOutput *.iprSee the examples in the docs for IdeaProject.
- 
setOutputFile
- 
getProjectLibrariesThe project-level libraries to be added to the IDEA project.
- 
setProjectLibraries
- 
getPathFactory
- 
setPathFactory
- 
mergeXmlProject
 
-