Find which dependency jars contain a given class

Hi,

is there a way to ask gradle to list the dependency jars that contain a given class?

For example, I’d like to know if the class:

javax/ws/rs/core/MultivaluedMap

Is included in more than one of the jars that are being bundled into my war file as 3rd party dependencies.

I’ve had a play with the dependencies and dependencyInsight tasks but these work “in the other direction” (as dependency oriented), I need to work from class back to dependency/dependencies.

Thanks, Andy

PS - not directly related to my question but the reason I’m asking is I have an existing RESTEasy based web application packaged as a war file running in Tomcat 8 that runs fine on Mac OS and Win Server 2016 but fails when running in a Linux Docker container with the stack trace:

java.lang.NoSuchMethodError: org.jboss.resteasy.specimpl.BuiltResponse.getHeaders()Ljavax/ws/rs/core/MultivaluedMap;
org.jboss.resteasy.core.ServerResponseWriter.setDefaultContentType(ServerResponseWriter.java:186)
org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:46)
org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

My current hypothesis is that I’ve got multiple versions of MultivaluedMap floating about in the dependency jars and I’d like to (quickly) prove that hypothesis true or false.