Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove a dependency from IntelliJ which I added through pom.xml?

I added Spring Security to my dependencies in the pom.xml and IntelliJ IDEA then downloaded it. I checked the http://localhost:8080 and got redirected to http://localhost:8080/login.

I now want to remove the dependency I added. I removed the dependency from the pom.xml but the login page is still there, and I can still see it in IntelliJ in the dependencies of Maven.

How can I completely remove the dependency?

like image 396
Matthieu Raynaud de Fitte Avatar asked Nov 30 '25 08:11

Matthieu Raynaud de Fitte


2 Answers

When you made the change to pom.xml, a popup probably would have appeared at the bottom-right of the IDE saying:

Maven projects need to be imported
Import Changes       Enable Auto-Import

If you click 'Import Changes', you should find that IntelliJ reloads the POM file and removes the dependencies that you've deleted.

Assuming you no longer have that popup on the screen, you can achieve the same thing by opening the 'Maven' tab on the right-hand side of the screen and clicking the 'Reimport All Maven Projects' button (looks like a refresh button with two arrows in a circle).

Maven tool window

You can also have IntelliJ do this for you automatically. If the popup mentioned above is still open, simply click 'Enable Auto-Import', otherwise open the settings and navigate to:

Build, Execution, Deployment > Build Tools > Maven > Importing

then select the option "Import Maven projects automatically".

like image 92
DPWork Avatar answered Dec 02 '25 03:12

DPWork


It is probably because it is loading the jar files from the cache location. You can clear that clicking on Reload All Maven Projects button present on the right hand section of screen, under Maven as shown in this screenshot.

Reload All Maven Project Once it is done, rerun your project. It should work as expected.

like image 28
Gautham Churchill Avatar answered Dec 02 '25 03:12

Gautham Churchill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!