OK, found the solution to UT/IT folder issue and my question (1) in this post. It's actually the "cleanTest" task which is one of the default RULE in Gradle.
Running "gradle tasks -all" gives a big output of tasks that Gradle supports and this output at the end tells about such Rules where if we call clean, then it'll wipe those folders. As you see in my code above, integrationTest was dependent upon cleanTest, thus when I called "gradle clean build integrationTest" it ran units tests first (via build task as Unit tests runs by default with the build step in Gradle) and then integration tests via "integrationTest" task, therefore, while running integration tests, it called cleanTest task, which wiped out "UT" folder which i have mentioned in a common gradle script (/init.d/commmon-some-name.gradle file) like I mentioned IT folders for reports/results directories.
Removing cleanTest as a dependsOn from integrationTest task, resolved wiping out issue.
task integrationTest( type: Test, dependsOn: cleanTest ) {
//task integrationTest( type: Test ) {
Output of following command: showing only last few lines...
gradle tasks -all
integrationTest
classes - Assembles binary 'main'.
cleanTest
compileIntegrationTestJava - Compiles source set 'integrationTest:java'.
compileJava - Compiles source set 'main:java'.
integrationTestClasses - Assembles binary 'integrationTest'.
processIntegrationTestResources - Processes source set 'integrationTest:resources'.
processResources - Processes source set 'main:resources'.
jarService
sonarRunner [test]
Rules
-----
Pattern: build: Assembles the artifacts of a configuration.
Pattern: upload: Assembles and uploads the artifacts belonging to a configuration.
Pattern: clean: Cleans the output files of a task.
BUILD SUCCESSFUL