Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable copying Java Resources in Gradle

When I run the building task in gradle, it copies all the java resources (from src/main/resources) into build/resources. Because I have too heavy files there my build process significantly slower that it could be.

Is there any way to disable copying them and force java to use them just from src/main/resources ?

like image 583
Soid Avatar asked Nov 02 '22 18:11

Soid


1 Answers

It depends. If you don't need any resource filtering and don't need access to resources from tests in the same project, you can do:

sourceSets.main.resources.srcDirs = []
jar {
    from "src/main/resources"
}
like image 192
Peter Niederwieser Avatar answered Nov 09 '22 10:11

Peter Niederwieser