cpl
cpl

Reputation: 1

How to distinguish whether the class files in the jar package belong to itself or its dependencies?

I'm working on some jars and building call graphs by analyzing bytecode files. I only want to analyze the class files belonging to the jar package itself, not its dependencies

The Maven central repository does not stipulate that the uploaded jar package must have its dependencies or not, and the class files in the jar package are not always organized according to groupId and artifactId.

For example, I download antisamy-1.5.3.jar from [Maven Central Repository] (https://search.maven.org/). And its id is org.owasp.antisamy:antisamy:1.5.3. The following figure is the directory organization structure of this jar package. enter image description here We can see that the path where the class file is located is not prefixed with groupId and artifactId.

There is an another expamle called org.apache.sling.xss-2.0.0.jar with the id org.apache.sling:org.apache.sling.xss:2.0.0.It looks like this jar package contains many class files from its dependencies. enter image description here

Did anyone know how to distinguish them from its dependency class files?

Thanks a lot!

Upvotes: 0

Views: 55

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35843

"Normal" libraries don't contain their dependencies.

But there are exceptions, like OSGi bundles or fat JARs. I don't think it is always possible to tell the internal and external classes apart, though in most cases, the Java packages will help you.

Upvotes: 0

Related Questions