Skip to content

Instantly share code, notes, and snippets.

@compwron
Last active June 20, 2016 23:53
Show Gist options
  • Save compwron/7838187 to your computer and use it in GitHub Desktop.
Save compwron/7838187 to your computer and use it in GitHub Desktop.
Set annotation processing to "on" when using gradle idea plugin (Intellij 12)
idea.module {
testSourceDirs += file('src/test/unit/java')
testSourceDirs += file('src/test/unit/resources')
excludeDirs += 'file://$MODULE_DIR$/src/main/webapp/node_modules'
}
idea.project {
ipr.withXml { provider ->
def node = provider.asNode()
def compilerConfig = node.component.find { it.'@name' == 'CompilerConfiguration'}
compilerConfig.annotationProcessing[0].'@enabled' = 'true'
}
}
@guai
Copy link

guai commented Oct 28, 2015

Here is for 14:

def ccfg = root.component.find { it.@name == 'CompilerConfiguration' }
ccfg.remove(ccfg.annotationProcessing)
ccfg.append(new NodeBuilder().annotationProcessing() {
    profile(default: true, name: 'Default', enabled: true) {
        processorPath(useClasspath: true)
    }
})

@JLLeitschuh
Copy link

Neither of these solutions work for 15.
The earlier one updates the .ipr file correctly but intellij doesn't recognize the changed setting.
Any updates on how to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment