# Class IdeaProject

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

All Implemented Interfaces:
  `Describable, IdeWorkspace`

public abstract class IdeaProject extends Object implements IdeWorkspace
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
          }
        }
      }
    }

Since:
  1.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected IdeaLanguageLevel`
  `languageLevel`
  The language level.
  `protected JavaVersion`
  `targetBytecodeVersion`
  The target bytecode version.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdeaProject(Project project, XmlFileContentMerger ipr)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getDisplayName()`
  Returns the display name of this object.
  `XmlFileContentMerger`
  `getIpr()`
  Deprecated.
  Will be removed in Gradle 10.
  `String`
  `getJdkName()`
  The java version used for defining the project sdk.
  `IdeaLanguageLevel`
  `getLanguageLevel()`
  The default Java language Level to use for this project.
  `Provider<RegularFile>`
  `getLocation()`
  Returns the location of the generated workspace.
  `List<IdeaModule>`
  `getModules()`
  Modules for the ipr file.
  `String`
  `getName()`
  The name of the IDEA project.
  `File`
  `getOutputFile()`
  Output *.ipr
  `PathFactory`
  `getPathFactory()`
  Deprecated.
  Will be removed in Gradle 10.
  `Project`
  `getProject()`
  An owner of this IDEA project.
  `Set<ProjectLibrary>`
  `getProjectLibraries()`
  Deprecated.
  Will be removed in Gradle 10.
  `JavaVersion`
  `getTargetBytecodeVersion()`
  The target bytecode version to use for this project.
  `String`
  `getVcs()`
  The vcs for the project.
  `Set<String>`
  `getWildcards()`
  The wildcard resource patterns.
  `void`
  `ipr(Closure closure)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `ipr(Action<? super XmlFileContentMerger> action)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `mergeXmlProject(Project xmlProject)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `setJdkName(String jdkName)`
  Sets the jdk name.
  `void`
  `setLanguageLevel(Object languageLevel)`
  Sets the java language level for the project.
  `void`
  `setLanguageLevel(IdeaLanguageLevel languageLevel)`
  Sets the java language level for the project.
  `void`
  `setModules(List<IdeaModule> modules)`
  Sets the modules.
  `void`
  `setOutputFile(File outputFile)`
  Sets the output file.
  `void`
  `setPathFactory(PathFactory pathFactory)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `setProjectLibraries(Set<ProjectLibrary> projectLibraries)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `setTargetBytecodeVersion(JavaVersion targetBytecodeVersion)`
  Sets the target bytecode version.
  `void`
  `setVcs(String vcs)`
  Sets the vcs.
  `void`
  `setWildcards(Set<String> wildcards)`
  Sets the wildcards.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### languageLevel

    protected IdeaLanguageLevel languageLevel
    The language level.
    Since:
      8.6

  - ### targetBytecodeVersion

    protected JavaVersion targetBytecodeVersion
    The target bytecode version.
    Since:
      8.6

- ## Constructor Details

  - ### IdeaProject

    @Inject public IdeaProject(Project project, XmlFileContentMerger ipr)

- ## Method Details

  - ### getDisplayName

    public String getDisplayName()
    Description copied from interface: `Describable`
    Returns the display name of this object. It is strongly encouraged to compute it lazily, and cache the value if it is expensive.
    Specified by:
      `getDisplayName` in interface `Describable`
    Returns:
      the display name

  - ### getLocation

    public Provider<RegularFile> getLocation()
    Description copied from interface: `IdeWorkspace`
    Returns the location of the generated workspace.
    Specified by:
      `getLocation` in interface `IdeWorkspace`

  - ### getProject

    public Project getProject()
    An owner of this IDEA project.

    If IdeaProject requires some information from gradle this field should not be used for this purpose.

    Since:
      2.11

  - ### getIpr

    @Deprecated public XmlFileContentMerger getIpr()
    Deprecated.
    Will be removed in Gradle 10.
    See `ipr(Action)`
    Since:
      1.0

  - ### ipr

    @Deprecated public void ipr(@DelegatesTo(XmlFileContentMerger.class) Closure closure)
    Deprecated.
    Will be removed in Gradle 10.
    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`

    Since:
      1.0

  - ### ipr

    @Deprecated public void ipr(Action<? super XmlFileContentMerger> action)
    Deprecated.
    Will be removed in Gradle 10.
    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`

    Since:
      3.5

  - ### getName

    public String getName()
    The 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.
    Since:
      1.0

  - ### getModules

    public List<IdeaModule> getModules()
    Modules for the ipr file.

    See the examples in the docs for `IdeaProject`

    Since:
      1.0

  - ### setModules

    public void setModules(List<IdeaModule> modules)
    Sets the modules.
    Since:
      1.0

  - ### getJdkName

    public String getJdkName()
    The java version used for defining the project sdk.

    See the examples in the docs for `IdeaProject`

    Since:
      1.0

  - ### setJdkName

    public void setJdkName(String jdkName)
    Sets the jdk name.
    Since:
      1.0

  - ### getLanguageLevel

    public IdeaLanguageLevel getLanguageLevel()
    The default Java language Level to use for this project.

    Generally, it isn't recommended to change this value. Instead, you are encouraged to set `sourceCompatibility` and `targetCompatibility` for 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.

    Since:
      1.0

  - ### setLanguageLevel

    public void setLanguageLevel(IdeaLanguageLevel languageLevel)
    Sets 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

  - ### setLanguageLevel

    public void setLanguageLevel(Object languageLevel)
    Sets 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.

    Since:
      1.0

  - ### getTargetBytecodeVersion

    public JavaVersion getTargetBytecodeVersion()
    The target bytecode version to use for this project.

    Generally, it isn't recommended to change this value. Instead, you are encouraged to set `sourceCompatibility` and `targetCompatibility` for 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 `languageLevel` is not explicitly set, this is calculated as the maximum target bytecode version for the Idea modules of this Idea project.

    Since:
      2.11

  - ### setTargetBytecodeVersion

    public void setTargetBytecodeVersion(JavaVersion targetBytecodeVersion)
    Sets the target bytecode version.
    Since:
      2.12

  - ### getVcs

    public String getVcs()
    The 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`.

    Since:
      2.2

  - ### setVcs

    public void setVcs(String vcs)
    Sets the vcs.
    Since:
      2.2

  - ### getWildcards

    public Set<String> getWildcards()
    The wildcard resource patterns.

    See the examples in the docs for `IdeaProject`.

    Since:
      1.0

  - ### setWildcards

    public void setWildcards(Set<String> wildcards)
    Sets the wildcards.
    Since:
      1.0

  - ### getOutputFile

    public File getOutputFile()
    Output *.ipr

    See the examples in the docs for `IdeaProject`.

    Since:
      1.0

  - ### setOutputFile

    public void setOutputFile(File outputFile)
    Sets the output file.
    Since:
      1.0

  - ### getProjectLibraries

    @Deprecated public Set<ProjectLibrary> getProjectLibraries()
    Deprecated.
    Will be removed in Gradle 10.
    The project-level libraries to be added to the IDEA project.
    Since:
      1.5

  - ### setProjectLibraries

    @Deprecated public void setProjectLibraries(Set<ProjectLibrary> projectLibraries)
    Deprecated.
    Will be removed in Gradle 10.
    Sets the project-level libraries.
    Since:
      1.5

  - ### getPathFactory

    @Deprecated public PathFactory getPathFactory()
    Deprecated.
    Will be removed in Gradle 10.
    Returns the path factory used to construct paths in the generated *.ipr file.
    Since:
      1.0

  - ### setPathFactory

    @Deprecated public void setPathFactory(PathFactory pathFactory)
    Deprecated.
    Will be removed in Gradle 10.
    Sets the path factory used to construct paths in the generated *.ipr file.
    Since:
      1.0

  - ### mergeXmlProject

    @Deprecated public void mergeXmlProject(Project xmlProject)
    Deprecated.
    Will be removed in Gradle 10.
    Merges the existing *.ipr content with the configuration from this model.
    Since:
      1.0