Exclude directory from sourceSet not working in Gradle

I want to exclude the directory in Gradle .. I use the following code .. When I do minus (I also tried exclude , the directory I am trying to delete is still present in srcDirs (when I output it at the end).

Suggestions?

 apply plugin: 'java' sourceSets { test { java { srcDirs 'src/test/unit/java' minus 'src/test/java' } } } task outputDirs << { sourceSets.test.java.srcDirs.each{f -> println(f)}} 
+6
source share
1 answer

try this instead:

 apply plugin: 'java' sourceSets { test { java { srcDirs = ['src/test/unit/java'] } } } task outputDirs << { sourceSets.test.java.srcDirs.each{f -> println(f)}} 

This reassigns the list of source directories (there is only one here) for the srcDirs property. using

 srcDirs = 'src/test/unit/java' 

as in your example, it simply adds another source folder to the existing ones.

Regards, Renee

+8
source

Source: https://habr.com/ru/post/910940/


All Articles