It is abnormal to explicitly specify a path to include in WEB-INF/classes. The War task will automatically split items placed on the classpath to the correct location. i.e.
war {
classpath(fileTree(customBuildPath))
}
However, your snippet does not show anything that would contribute to WEB-INF/lib. The war plugin is going to automatically include items from the runtimeClasspath, so it’s likely something included in dependencies is not quite right if there is no other configuration that modifies the war task directly.
I am expecting that you mean that the same classes are also in a JAR in WEB-INF/lib, not that there are class files outside of a JAR in WEB-INF/lib.