Write a plugin to download statistics directly on the Nexus Repository Manager

I want to develop a plugin for Nexus repository manager. This plugin will display a “Download statistics” button on the UI.
Based on the user rights, it will create an Excel file (or/and others formats) with the usages and statistics of the differents repositories of the user.

Firstly, is it possible to develop a plugin/bundle wich add an action on the UI?

I’m new on Nexus development, I read the various documentations but do you have any examples and advices you can tell me on this?

Thanks you in advance.

You can add entries to the navigation (the left sidebar), e.g. nexus-public/UploadComponent.js at 4caccd14e094a7325bd57f7389045c9462a95911 · sonatype/nexus-public · GitHub

An example of a plugin contributing to the UI generally is the onboarding plugin -

Alternatively you could develop a UI plugin with React. This is a relatively new way to work on the frontend so we don’t have any public documentation yet. You can look at the nexus-coreui-plugin to see how we’re contributing React code to the frontend. In particular the index.js file adds new items to the left-hand navigation. nexus-public/index.js at master · sonatype/nexus-public · GitHub

1 Like

Thank you ! I’m checking this. It’s gonna take me a while to figure out how this works.
Is there a way to launch nexus-public in debug mode ?
Actually I built it and run “nexus console” but if possible, I want to debug the code step by step.

For the UI if running locally - http://localhost:8081/?debug

Oh to note we’re also slowing switching to react, there are some examples in the public code you could look at those too if you prefer.

For Java using KARAF_DEBUG=true and starting nexus should allow you to attach a debugger.

1 Like

http://localhost:8081/?debug is working to debug the UI.

For the Java code, usage of KARAF_DEBUG environement variable is not working for me.
I found a way by launching “nexus console debug” command to start Nexus.

I will see to use React for all UI interractions of my code.

Hello, I start to understand how the code works. But I’m not a Javascript expert and I need help on somes points :

  • You was talking about react code, I found it in “frontend” directories (coreui-plugin and ui-plugin). I can see the load of the descriptor at the start of Karaf. But I can’t find the code in .kar file or .jar file… I don’t know how it works.

  • I followed your instructions to add a new item on the left-hand navigation but nothing is displayed… I tried with both methods “React” and “ExtJs”. In the console of my browser I see the load of my PluginConfig and my controller. I think I missed something…

  • When I type the path to my feature in the URL (for now it’s “…#browse/report”), I’m bloked on a popup “You have requested an operation which requires validation of your credentials.” I can see the title of my page on the back.

It will help me a lot if you can give me somes explanations and advices. I try to develop with both “React” and “ExtJs” to understand all.

Thanks in advance.

I just published my work on github if you want to take a look :


Nice work @mat1e!!
I installed this and it works in 3.27.0. I’ll keep an eye out for additional areas where this plugin will provide some value.

Thank you @mworthington for your reply !
I am listening if you see improvements to be made.

My problem right now is to build the plugin on a Continuous Integration platform.
Because of the dependency with UI components of nexus-ui-plugin, I can’t build the plugin separatly from nexus-public repository.

I need help to find the right solution.

I opened a ticket on Jira : DX-112

Salut @mat1e ,
Installing this plugin would bring some statistics about how many time a package has been downloaded ?
Is it compatible with docker, pypi and apt ?

Hi Alex,
Sorry for the delay. Yes you can get how many times a package is downloaded. The plugin is just extracting Nexus available values of all packages of a repository.
It is compatible with all Nexus repositories types.

1 Like