Gradle idea plugin does not properly mark resources directories

This commit is contained in:
Yannick Welsch 2015-12-15 17:32:21 +01:00
parent 2f97ff0925
commit 887789d1a9
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 {