Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who is using my maven artifact?

I have a system consisting of multiple web applications (war) and libraries (jar). All of them are using maven and are under my control (source code, built artifacts in Nexus,...). Let say that application A is using library L1 directly and L2 indirectly (it is used from L1). I can easily check the dependency tree top-down from the application, using maven's dependency:tree or graph:project plugins. But how can I check, who's using my library? From my example, I want to know, whether A is the only application (or library) using L1 and that L2 is used from L1 and from some other application, let say B. Is there any plugin for maven or nexus or should I try to write some script for that? What are your suggestions?

like image 669
Kojotak Avatar asked Oct 15 '13 22:10

Kojotak


2 Answers

If you wish to achieve this on a repository level, Apache Archiva has a "used by" feature listed under project information

See screenshot.

This is similar to what mvnrepository.com lists under its "used by" section of an artifact description.

Unfortunately, Nexus does not seem to provide an equivalent feature.

Now I suppose it would be a hassle to maintain yet another repository just for that, but then it would probably easier than what some other answers suggestions, such as writing a plugin to Nexus. I believe Archiva can be configured to proxy other repositories.

Update

In fact, there's also a plugin for Nexus to achieve the "used by" feature.

like image 155
Boj Avatar answered Oct 17 '22 02:10

Boj


As far as I know nothing along these lines exists as an open source tool. You could write a Nexus plugin that traverses a repo and checks for usages of your component in all other components by iterating through all the pom's and analyzing them. This would be a rather heavy task to run though since it would have to look at all components and parse all the poms.

In a similar fashion you could do it on a local repository with some other tool. However it probably makes more sense to parse the contents of a repo manager rather than a local repository.

like image 44
Manfred Moser Avatar answered Oct 17 '22 01:10

Manfred Moser