Introduction
An .iml file describes a module in JetBrains’
IntelliJ IDEA and the other IDEs built on
the same platform, such as PyCharm and Android Studio. A project is made of one or more
modules; each module’s file lists its source, test and resource folders, the folders to
leave out, and the libraries and other modules it depends on.
The project’s own settings live in the .idea folder beside it, as a set
of XML files, including modules.xml, which lists the project’s
.iml files. When a project is imported from Maven or
Gradle, the IDE works the modules out from the build
files instead, and may not write .iml files at all.
Structure
An .iml file is XML with a module root whose
type attribute names the kind of module, such as
JAVA_MODULE. A component element named
NewModuleRootManager holds a content element with the
sourceFolder and excludeFolder entries, then
orderEntry elements for the SDK, the module’s own sources, libraries and
other modules. Paths are written relative to the module with the
$MODULE_DIR$ macro.
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Links
Software
- IntelliJ IDEA (Windows, macOS, Linux)
- PyCharm and the other JetBrains IDEs (Windows, macOS, Linux)
- Android Studio (Windows, macOS, Linux)