Merge pull request #15452 from ywelsch/fix/gradle-idea-resources

Gradle idea plugin does not properly mark resources directories
This commit is contained in:
Yannick Welsch 2015-12-18 17:27:49 +01:00
commit 3a95516b79
1 changed files with 24 additions and 0 deletions

View File

@ -179,6 +179,30 @@ gradle.projectsEvaluated {
// intellij configuration
allprojects {
apply plugin: 'idea'
idea {
module {
// same as for the IntelliJ Gradle tooling integration
inheritOutputDirs = false
outputDir = file('build/classes/main')
testOutputDir = file('build/classes/test')
iml {
// fix so that Gradle idea plugin properly generates support for resource folders
// see also https://issues.gradle.org/browse/GRADLE-2975
withXml {
it.asNode().component.content.sourceFolder.findAll { it.@url == 'file://$MODULE_DIR$/src/main/resources' }.each {
it.attributes().remove('isTestSource')
it.attributes().put('type', 'java-resource')
}
it.asNode().component.content.sourceFolder.findAll { it.@url == 'file://$MODULE_DIR$/src/test/resources' }.each {
it.attributes().remove('isTestSource')
it.attributes().put('type', 'java-test-resource')
}
}
}
}
}
}
idea {