Configuration process fails on first build process since of missing files

Hey guys.

Recently our system has been updated to a newer version which involves now Gradle and no more ANT. The system needs a set of .properties or .xml files to function differently depending on the executing machine. I migrated the code from ANT to Gradle and now depending on the user or machine several files (.xml or .properties) are filled with specific and different values provided by other .properties files and are spread out into different folders and subfolders. Theses file do not exist on forking the project and are created before running the build script.

So a typical script scenario would be: ./gradlew cleanAll build
Where build dependsOn the explained configuration process.

The problem is that on first execution the compiling of many java files fails since related packages can not be found.

On all other attemps the process succeeds (without cleanAll) since on execution the files are known.

I guess that the files are missing in the cache or in some other form and I could not find a solution to make the files known for the gradle build process (rather said: the compilation of .java) after they have been created.

I hope you understand my problem on which I cant find a solution (I am also quite new to gradle).

I read some information about adding those newly created files to the classpath however since the files are spread out into very deep hierachical folder structures and it should be highly dynamic on different forks I am unsure whether the given information really suits the problem and offers an solution…

If everything works when the generated files are already present (without clean), your configuration process task isn’t just a dependency of build. Your description suggests that these files are required for compilation. Therefore, you probably want all the JavaCompile tasks to depend on your configuration process, not just build dependsOn:

tasks.withType(JavaCompile) {
    dependsOn yourConfigurationProcessTask
}