Skip to content

IntelliJ KBean

Manages Intellij metadata files.

IntellijKBean provides methods for generating IntelliJ IDEA metadata files. It generates .iml module files and, when a ProjectKBean is present, also synchronizes .idea/compiler.xml.

Sync

Run jeka intellij: sync (or jeka intellij#sync) to generate/update IntelliJ metadata.

What gets generated: - The module .iml file with all classpath entries. - .idea/compiler.xml — annotation-processor configuration and per-module javac options, derived from the project build definition.

Annotation Processors in IntelliJ

When your project declares annotation-processor dependencies in the [processor] section of jeka.project.deps, the sync action automatically configures IntelliJ's built-in annotation processing by writing the resolved processor jars into .idea/compiler.xml. This means IntelliJ will run annotation processors (e.g. Lombok, MapStruct) natively during incremental builds, without needing a separate external build step.

compiler.xml Sync Options

The compilerOptions group controls what is written into .idea/compiler.xml:

Property Description Default
compilerOptions.sync If true, updates .idea/compiler.xml on sync. true
compilerOptions.syncProcessorPaths If true, writes annotation-processor paths into compiler.xml. true
compilerOptions.syncJavacOptions If true, writes per-module javac options into compiler.xml. true

Example — disable compiler.xml sync entirely:

# jeka.properties
@intellij.compilerOptions.sync=false

Customizing the .iml File

Configuration in a Build.java class
@JkPostInit
private void postInit(IntellijKBean intellijKBean) {
    intellijKBean
            .replaceLibByModule("dev.jeka.jeka-core.jar", "core")
            .setModuleAttributes("core", JkIml.Scope.COMPILE, null);
}

Summary

Manages Intellij metadata files.

This KBean exposes the following fields:

Field Description
useVarPath [boolean] If true, dependency paths will be expressed relatively to $JEKA_REPO$ and $JEKA_HOME$ path variable instead of absolute paths.
failOnDepsResolutionError [boolean] If true, the iml generation fails when a dependency can not be resolved. If false, it will be ignored (only a warning will be notified).
splitModule [boolean] Experimental: If true, 'jeka-src' will have its own IntelliJ module.
focus [enum:IntellijKBean$SyncFocus] Experimental: If 'jeka-src' is in its own module, the 'sync' action can target it specifically.
downloadSources [boolean] If true, sources will be downloaded will resolving dependencies.
compilerOptions.sync [boolean] If true, the compiler.xml file will be generated according settings declared in Jeka.
compilerOptions.syncProcessorPaths [boolean] If true, and sync=true, the generated compiler.xml will include annotation processors declared in Jeka.
compilerOptions.syncJavacOptions [boolean] If true, and sync=true, the generated compiler.xml will include javac options declared in Jeka.

This KBean exposes the following methods:

Method Description
initProject Re-init the project by deleting workspace.xml and regenerating .idea/modules.xml.
modulesXml Generates ./idea/modules.xml file by grabbing all .iml files presents in root or sub-directory of the project.
sync Generates IntelliJ [my-module].iml file.
syncAll Generates iml files on this folder and its descendant recursively.