Well that is a heritage from Ant I guess, though the statement only adds a new resourcedir to the set of resourcedirs

It would be better to use:

sourceSets.main.resources.srcDirs = files('src/main/java')

Though that would be just a slight change. Also an exclude for "**/*.java" might be desired here.

Though mixing the sources and resources together might be not ideal, usually it is not a problem for Gradle.

On 8/21/21 11:01 AM, Bernd Michaely wrote:

Hi,

I'm just curious,

     sourceSets {
         main {
             resources {
                 srcDirs"src/main/java" }
         }
       }

Is it good practice to define the resources dir equal to the src dir?

I think, this might cause problems including:

  * it (at least unnecessarily) confuses Gradle's build cache
  * resources are deployed to the final result, so sources might be
    deployed together with the them
  * NB show src and resources separately in the logical Projects view
    and might be confused about this configuration

Greetings,

Bernd


Reply via email to