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?

Upvotes: 3

Views: 12263

Answers (3)

Gautham Churchill
Gautham Churchill

Reputation: 161

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.

Upvotes: 2

DPWork
DPWork

Reputation: 488

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".

Upvotes: 4

Mahesh_Loya
Mahesh_Loya

Reputation: 2832

IntelliJ IDEA caches files and dependencies.

  1. Try to invalidate cache. as below -

enter image description here

  1. Close intellij

  2. Remove ...\home.IntelliJIdea14\system\Maven - cache for maven artifacts, you can probably delete it.

  3. Module and project informations are stored within the project - .idea folder and *.ipr and *.iml files, you can delete them to be sure and reimport the project.

Upvotes: 1

Related Questions