I'm trying to setup a multi-module gradle project with idea support. It works until I'm adding project-wide gradle.properties to the mix. Here's an example:
gradle.properties:
javaVersion = 1.8
gradle.settings:
include 'module_a'
build.gradle:
allprojects {
apply plugin: 'idea'
idea {
project {
jdkName = javaVersion
}
}
}
module_a is an empty sub-folder.
gradle idea
fails with this:
Build file 'project/build.gradle' line: 7
* What went wrong:
A problem occurred evaluating root project 'project'.
> Cannot set property 'jdkName' on null object
What could be the reason?
Question 2: can a sub-project make modifications to the global idea
task, for instance
idea.module.generatedSourceDirs += file('srm/main/java.generated')
Will it only affect module_a
if placed in module_a/build.gradle
?
Thanks
You can't set "jdkName" on every subproject, it only should set on the root project like this:
idea {
project {
jdkName = "1.8"
languageLevel = "1.8"
}
module {
name = "My root project name"
}
}
On the sub projects you can config other things like
idea.module.testSourceDirs = idea.module.testSourceDirs+idea.module.sourceDirs
idea.module.sourceDirs = [] as Set
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With