Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 888
Hoshani Avatar asked Oct 14 '25 15:10

Hoshani


2 Answers

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.

like image 130
Rob Audenaerde Avatar answered Oct 17 '25 03:10

Rob Audenaerde


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.

like image 31
Hiran Chaudhuri Avatar answered Oct 17 '25 04:10

Hiran Chaudhuri