Issue
I am getting below error while installing Findbugs into Netbeans 8.2:
"There were some problems while storing Establishing a connection …
Cause: Cannot resolve external reference to m2:/org:ow2:asm:asm-debug-all:5.0.2:jar"
I have tried uninstalling NetBeans 8.2 and removing anything associated with the installation to get a fresh install with no success there, and I have tried the latest version of NetBeans 11.3 which I found does not have Findbugs available. I need the plugin for a school project and no one there has been able to help me with this issue either. Any help would be greatly appreciated.
I am using a Windows 10 PC.
Thank you.
Solution
The reason of the error
The error happens because when you download the plugin, NetBeans also tries to download additional dependencies. The links where to download the jars from are written inside the nbm
package.
For example, one of the dependencies is asm-debug-all-5.0.2.jar
, and the link is:
http://repo1.maven.org/maven2/org/ow2/asm/asm-debug-all/5.0.2/asm-debug-all-5.0.2.jar.
The maven repository is no longer accessible using the HTTP
link. You can read more about it here.
So basically, you could not install the plugin because the plugin is outdated and contains invalid links for downloading dependencies from maven repo.
Before solving the issue, consider using SpotBug instead because the FindBug is outdated and is no longer actively maintained, for more information, please, see here in another answer. Also, keep in mind that it works only with JDK8.
How to solve it?
To solve the issue, you need to fiddle around a bit with plugins.
- You need two plugins FindBug Libs (
org-netbeans-libs-findbugs.nbm
) and FindBug Integration (org-netbeans-modules-findbugs.nbm
). Download them using thees links:
- Unzip org-netbeans-libs-findbugs.nbm manually as if it is a simple zip file.
- Edit the files in org-netbeans-libs-findbugs\netbeans\modules\ext extracted folder. In every file, you need to change the link from http to https.
Edit manifest file org-netbeans-libs-findbugs\META-INF\MANIFEST.MF. You need to remove all lines that contain CRS checksum. After editing it should contains only these lines:
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.2 Created-By: 1.8.0_45-b14 (Oracle Corporation)
Remover other two files in org-netbeans-libs-findbugs\META-INF (ORACLE_C.RSA and ORACLE_C.SF).
Zip it again.
After that, the file is ready for manually installing into Net Beans. Alternatively, you can download the file from here. I have already modified the plugin using the steps.
How to install and use it?
- Got to Windows -> Plugins -> Downloaded -> Add Plugins
- Manually add the modified org-netbeans-libs-findbugs.nbm file and click install.
- Then add org-netbeans-modules-findbugs.nbm and click install.
- When installing, it shows that it downloads the plugin, but actually, it downloads only dependencies. It can take some time.
- After that, select your project in the project tree, make sure it was compiled before. Got to Source -> Inspect, choose FindBus in the Configuration.
- After you click to inspect your report will be ready. It works both on NetBeans 11.3 and 8.2. Make sure you are using JDK8 with NetBeans. I'm not sure it will work with the newest versions of JDK.
Here is an example with running it on 11.3 using JDK8 on some NetBeans module:
Answered By - Dmitry.M
Answer Checked By - Pedro (JavaFixing Volunteer)