1

I'm analyzing a jar statically. In this jar there are references to classes not defined neither into the jar itself nor in the pom.xml file or any other config file. How to retrieve automatically the jar containing the missing class without using an IDE?

Example: in the jython2.7.1b3 jar (https://mvnrepository.com/artifact/org.python/jython/2.7.1b3) there is a reference to "javax.servlet.HTTPServlet" (dependency found with JDeps) but not defined anywhere.

Edoardo Vignati
  • 433
  • 5
  • 14

1 Answers1

0

You can use the dependency tree of maven as done in this answer:

https://stackoverflow.com/a/3342951/7758117

Create an empty project with only a pom.xml and a dependency to your external dependency. As this jar has a pom.xml, you should then be able to run mvn dependency:tree on your project and then get the dependencies of your jar and which library uses this class.

B.vlt
  • 16
  • 4
  • I already tried this solution but the fact is that mvn dependency:tree works only if a pom.xml is provided into the target jar. In fact in the pom.xml of (in my case) jython2.7.1b3.jar doesn't contain the dependency section and so mvn cannot build the dependency tree – Edoardo Vignati Jan 09 '19 at 15:13