Source Directory Creation for Java Projects in Gradle 1.0-milestone-9


(Alexander Klein) #1

The Gradle cookbook describes how source directories can be created via build file (task create-dirs) for Gradle 0.9. This was working fine for me until Gradle 1.0-milestone-8 but is now broken in Gradle 1.0-milestone-9.

I would be grateful for an explanation on how this can be achieved now.

Many thanks


(Andrew Oberstar) #2

The getAll() method of DomainObjectCollection was removed. I included the link to the migration guide at the bottom.

sourceSets.all { set -> set.allSource.srcDirs.each { it.mkDirs() } }

The key being the all() method that takes a closure that will configure each source set.

http://wiki.gradle.org/display/GRADLE/Gradle+1.0-milestone-9+Migration+Guide#Gradle1.0-milestone-9MigrationGuide-org.gradle.api.DomainObjectCollection


(Alexander Klein) #3

Thanks so much and sorry for inadequate question. I intended to include a link to the cookbook and copy the code but missed that.