Gradle + SpringBoot bootwar = unexpected files under WEB-INF/classes

I have a gradle project with about 50 subprojects that builds into a war with embedded tomcat. It works great. But recently I needed to add a logback-test.xml plus a couple of files for tests to use. I put these in an “api” subproject (which contains a bunch of interfaces for spring services) in the src/test/resources source folder. All the tests work, great.

But something weird happens when I build my war. Those three files get picked up from api/src/test/resources and copied to the spring boot war under WEB-INF/classes. I have no idea why; I didn’t specify this in any of my build.gradle files. But as a result, logback finds the logback-test.xml file on the classpath and prefers it over the logback-spring.xml file that I wanted it to use. I need to stop these files from getting into my build!

If I move these files to another subproject’s src/test/resources source folder, they no longer get copied to the WEB-INF/classes dir in the executable war. But I wind up with other side effects, including potential circular dependencies. I really want to keep them under the api subproject.

It’s strange enough that something in a test resources folder gets added to the main war. But how do I keep them out? Is this really an issue with the spring boot bootwar task? There is configuration for controlling the content of the WEB-INF/lib folder, but not the WEB-INF/classes folder.