Hoshani
Hoshani

Reputation: 856

Is there a way to list projects using a specific maven package?

Background:

I have multiple projects that utilize the same logic across their business so I decided to split the shared part and reference it in both projects.

Example:

Suppose there is an HR application and an Accounting application that require a shared business in this case let's say count hours which is part of calculations class (let's call it calc).

Both applications (HR & Accounting) have their own repository on gitlab. Also have independent deployment and utilize the calc package which is uploaded on nexus repository.

enter image description here

Question:

I would like to know if there is a way to find projects using calc package through the package name across the repositories.

Upvotes: 4

Views: 673

Answers (2)

Rob Audenaerde
Rob Audenaerde

Reputation: 20099

If you have the projects that you want checked out locally, you could find the dependency-tree for each project:

mvn depedency:tree

This gives you all the (transitive) dependencies that are used the projects. If you do this for each project and then grep your package-name, this should find you all projects that use it, or at least have a dependency on it.

Upvotes: 5

queeg
queeg

Reputation: 9473

I am not sure how to calculate dependencies through package names. But:

  • If you have access to the source you can scan your projects for pom.xml and find the dependencies
  • If you have access to the runtime libraries you can scan these jars for /META-INF/maven/*/*/pom.xml and check the dependencies

Either way you should be able to find jar files making use of Calc. There is no way to ask Calc where it got used from.

Upvotes: 1

Related Questions