This happens to me when that library is defined as 'class' in the project structure settings of IntelliJ. Removing it fixed my problem.
Go -> File -> Project Structure -> Libraries
Click the library that is causing the issue from the list
Click to the element within the 'classes' part in this section and remove it using the minus icon.