Creating a VirtualVM Repository with Artifactory OSS
According to their sire “VisualVM is a visual tool integrating commandline JDK tools and lightweight profiling capabilities. Designed for both development and production time use.”
Already a pretty neat piece of software VisualVM also offers easy extendability through the use of 3rd party plugins which include the MBeans Browser, Visual GC plugin, and more. These plugins come from Update Centers, which are essentially repositories containing these plugins, with the main one being the public VisualVM plugins center.
Sometimes it is the case that a company or organization cannot access these public repositories due to security constrains, which is why it’s necessary to keep them within a private universal repository manager.
In the following lines I will show you how to create your own VisualVM plugin Update Center with Artifactory in any of its versions (OSS, Pro, or Enterprise.)
Note that the preferred way to get plugins is using Tools | Plugins | Available Plugins. Manual download and installation should only be used in offline environments or when experiencing network problems.
The URL to a VisualVM Update Center is essentially just a link to a catalog file called updates.xml.gz which contains all the information of the plugins to put available. For this example I will download the catalog for version 1.3.9.
On the Artifactory side we will go ahead an create a generic repository, which we’ll call visual-vm-test
And that’s almost essentially it. We will now deploy the updates.xml.gz file we downloaded earlier to the root of the repository.
We officially have our Update Center ready. The full path to your file should be something along the lines of http://<server>:<port>/artifactory/visual-vm-test/updates.xml.gz
We can add this directly on Visual VM by going to VisualVM → Tools → Plugins → Settings → Add
Click ok and see how the Available Plugins page is now populated.
You can the modify the updates.xml file with any of your private plugins which can also be stored in an Artifactory generic repo, just reference the direct URL in the updates.xml.gz file.
But what if I just want to use the public one with Artifactory and keep it updated with theirs?
Great question! You can always create a remote generic repository. For example I created one called remote-visual-vm and
You may notice I did not include the updates.xml.gz at the end of the URL, that is done on purpose, we add that at when adding the repo on VisualVM
Just like before if you head over the Available Plugins tab you will see all of it populated. But what’s the benefit of this?
Well, if you now go and download a plugin from your remote VisualVM repository through Artifactory you’ll something along these lines in your Artifacts browser
Now the licenses and the updates.xml.gz files are cached, so even if the VisualVM website is down (thus VisualVM or Artifactory can’t get the catalog file) you will still be able to install your plugins (being that the references to GitHub inside the catalog file are still valid.)
I would like to figure out how to cache the plugins themselves, but being that VisualVM is the one resolving them through GitHub it doesn’t seem like Artifactory would have access to that part of the process.
Either way, I’d love to hear some feedback on this sort of hack-y way of getting these Update Centers going, but certainly a reliable way.
Until the next time.