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?
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).

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".
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.
Once it is done, rerun your project. It should work as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With