War with classes under WEB-INF/classes and jars under WEB-INF/lib

I’m trying to port a custom compiled Java webapp project into gradle.

I want to put all my *.class files under WEB-INF/classes and it works, but I find also the same *.class files under WEB-INF/lib

This is a snippet of my build.gradle

def customBuildPath = 'build/classes'

war {
    from(customBuildPath) {
        into 'WEB-INF/classes'
    }

    from('WebContent') {
        include 'Web/**/*'
        into ''
    }
}

Any hints?

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.