Reputation: 372
I have a built a springboot jar, and I want to exclude all logback.xml from fatjar using gradle. and I have tried in following way.
jar{
exclude '/BOOT-INF/lib/**/logback.xml'
}
Could some one please help me how to exclude all logback.xml from dependencies using gradle.
Upvotes: 3
Views: 15663
Reputation: 28099
I personally think that "excluding" things is an anti-pattern. So I'd flip your question on its head and ask "when do you need to include the files?" with the goal of including an extra folder only when it's needed (and not including the folder where it's not needed)
If the files are only needed for testing then the files should be moved to src/test/resources. If it's some other task that needs the files then I suggest you move the files to src/xxx/resources and add that folder only to the task(s) which need the files
As a convention, everything in src/main/resources goes into the jar. In my opinion this is a very sensible convention.
Upvotes: 0
Reputation: 15908
It depends on where are xml files has been kept.
You can try like below and change the path accordingly.
sourceSets { main { resources { exclude '**/*.xml' } } }
Upvotes: 0
Reputation: 11926
if you don’t care for the XML files to be copied from the src/main/resources
to the build/resources/main
folder (not just excluded when build/resources/main
is copied to the War), you could use like:
processResources {
exclude('manual/*.xml')
}
find more info here.
Upvotes: 4