When debugging, instead of adding more, why not try removing?

Imagine working on a code or configuration and following the official documentation to the letter. Yet you keep getting errors. After hours of trials, you can no longer fathom what is wrong.

Instead of adding more, why not try removing?

Existing configurations, libraries, or even codes might be interfering with what you’re trying to do.

A few days back, I was struggling to run a testNG Java project with Maven on an Azure Pipeline. At best, there was always either a null or Java Lang exception. Nevertheless, I tried all possible variations from the official docs. I’ve also navigated through multiple answers on StackOverflow. In fact, I grew even more confused.

Sitting back and reflecting on my work, I tried checking if there might be something causing this situation. For me at this point, it didn’t seem that the wrong Java, JDK or Maven version might be causing any trouble.

So I went back to the project starting point, the pom.xml file which was also the configurations location I was most at eased. My hypothesis was that maybe there was other settings overriding the default ones. The Maven SureFire plugin was being used. I also found though, the SureFire plugin was called twice more below with settings I didn’t understand.

I just commented these sections, committed on the remote branch and launched the build again. Hola. It worked. No more exceptions. The tests I included ran as they did locally.

Originally published at http://abdallahyashir.com on September 10, 2021.

--

--

Senior Software Developer, Writer, Amateur Photographer, Reader

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store