IdeaProject

abstract class IdeaProject : IdeWorkspace(source)

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

Constructors

Link copied to clipboard
@Inject
constructor(project: Project, ipr: XmlFileContentMerger)

Properties

Link copied to clipboard
Link copied to clipboard
open var jdkName: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var vcs: String
Link copied to clipboard
open var wildcards: Set<String>

Functions

Link copied to clipboard
Link copied to clipboard
The default Java language Level to use for this project.
Link copied to clipboard
Link copied to clipboard
open fun getName(): String
The name of the IDEA project.
Link copied to clipboard
open fun getOutputFile(): File
Output *.
Link copied to clipboard
The target bytecode version to use for this project.
Link copied to clipboard
open fun ipr(@DelegatesTo(value = XmlFileContentMerger::class) closure: Closure)
open fun ipr(action: Action<in XmlFileContentMerger>)
Enables advanced configuration like tinkering with the output XML or affecting the way existing *.ipr content is merged with Gradle build information.
Link copied to clipboard
open fun mergeXmlProject(xmlProject: Project)
Link copied to clipboard
open fun setLanguageLevel(languageLevel: Any)
open fun setLanguageLevel(languageLevel: IdeaLanguageLevel)
Sets the java language level for the project.
Link copied to clipboard
open fun setOutputFile(outputFile: File)
Link copied to clipboard
open fun setTargetBytecodeVersion(targetBytecodeVersion: JavaVersion)