My question is not like eg. http://forums.gradle.org/gradle/topics/the_gradle_jar_tasks_hangs_creating_an_infinitely_growing_jar_file_without_terminating
I think I actually discovered a bug, and if I understood correct this is the place to post it. Executive summary of problem: my gradle build hangs and creates an infinitely long jar under certain conditions. The project is a simple stand-alone project. Hopefully this makes it easy to reproduce the problem on your side. The folder structure is as follows, the project folder under which I have three flat directories:
src testsrc pack
project.version=‘0.0.1’ println “hello $project.name” buildDir = ‘pack’
apply plugin: ‘java’
repositories {
maven {
// URL can refer to a local directory
url “…/…/m2”
} }
uploadArchives {
repositories {
maven {
// URL can refer to a local directory
url “…/…/m2”
}
} }
dependencies { // I leave these out because I don’t think they are relevant } sourceSets {
main {
java {
srcDir ‘src’
}
resources {
srcDir ‘javaresources’
}
output.resourcesDir = ‘pack’;
output.classesDir = ‘pack’;
} }
As you notice, this build file assumes there is a javaresources dir. If I updated the sourceSets like this, then the system doesn’t hang and builds nicely:
sourceSets {
main {
java {
srcDir ‘src’
}
output.classesDir = ‘pack’;
} }
If I then add a javaresources directory, and put the build file like it was, the system hangs again. So I conclude that the infinite loop is not caused by the unexisting directory, but by the fact that src and resources share their output dir. I will now try to find a workaround, hopefully that will be easy to do. But I think the inifinite loop, possibly caused by an unavailable lock, should be looked at and hopefully fixed if you can reproduce it